rhg1968's Forum Posts

  • I have a personal license, but since C3 has been made open for the weekend it shows at the top free edition and my account name. If I try to load my project it says it exceeds the free edition.

    I can log out and log back in, but it still shows both my account name and the free edition tag and I can't work with my project. This is on version R195.

  • First you have to get a reference to an instance. Lets say you have one sprite called Enemy and there is only one in existence.

    const enemy = runtime.objects.Enemy.getFirstInstance();

    Now lets say that the sprite has a string instance value called Tag and I am going to display in the console.

    console.log(enemy.instVars.Tag);

  • Without looking at it too much my first guess as where to look is where you set the animation frame. It is zero indexed, so it would 0 and 1, not 1 and 2

  • Ashley

    I just submitted it, thank you

    https://github.com/Scirra/Construct-3-bugs/issues/3530

  • Mikal

    Just like anything there are pluses and minuses to either approach. I have had success with using the event sheet but I always reach a point where, to me, it seems convoluted to try and accomplish some tasks.

    I am a programmer so javascript is definitely more natural for me. I don't think performance is really an issue because you can optimize events pretty well and you can do the same with javascript, you can also write inefficient javascript code. You definitely have more control with how you accomplish things in JS, but that opens it up to any issues really falling on you as the developer.

    The biggest pluses for me with using JS are that debugging the logic is much easier for me using the chrome debugger than using the construct debugger. However, the info it provides such as utilization and FPS are awesome. Also being able to utilize functionality that isn't available out of the box is a good use for JS, whether you game is just using a little bit of it or the whole application is in JS. In my game I am able to manage users and store there current state object utilizing the PlayFab service api.

    The big downside to JS in construct is that there isn't a full blown development environment. It does provide excellent auto completion and syntax checking, but there aren't ways to search all files, refactor the name of a class and have it automatically rename all instances, find all references of a token, etc... So if you aren't careful with how you layout your code you can have a hard time finding things later on.

    Overall I think it depends on what you are comfortable with, your experience with JS, and whether your game can benefit from a little JS or a lot of JS.

    I have been programming in JS, C#, C++, and others for many years and find it easier for me.

    If you have any additional question, just let me know.

  • Ashley

    Here is a small example project that shows the behavior.

    I am using :

    chrome: 78.0.3904.108

    Construct3: r178

    If you run the example you will see in the console three object iterated over. If you perform an advanced minification, HTML export, on it you will see the count of properties iterated on the object are 0. If you change it from Object.Keys to Object.getOwnPropertyNames then it will work.

    https://drive.google.com/open?id=19-mik4je9LX6JinqBOcV8EvG_d-ezY2_

  • I believe I found the answer. The properties must be set as non-enumerable during the minification. If I use Object.getOwnPropertyNames() instead I can access all of the properties and everything works correctly.

  • I have everything pretty much working with advanced minification in my game except for one issue. My whole game is pretty much in javascript except for some touch events that then call into the code.

    I have implemented a pseudo entity control system in my game where I just assign components to my entities and I have an algorithm that can find any entity with any combination of components to act upon in the systems classes. One of my systems is a movement system and it handles moving anything that has a movement component attached to it.

    All of this works fine with no and simple minification, but not with advanced.

    The issue is I use es6 functions to iterate over, reduce, and flatten the final result of the component search. To do this I am iterating over the complete object collection as such Object.keys(this.runtime.objects). Under anything but advanced minification this returns an array of all properties on the objects object. In advanced minification it returns an empty array.

    Is there something happening during advanced minifcation that prevents the properties for the objects collection from being iterated over ?

  • There are a few examples in the IDE under the scripting examples. They show some basic things like you mentioned.

  • The new functions are global and don't need to be included explicitly. So just creating a function makes it available on any event sheet. That is why you can't have them named the same.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's not supported yet, but you could use runtime.callFunction() to call a function in the event sheet to set the animation. You could pass the uid so you can select the object in the function.

  • Does this mean that if we add the js files to the imported files section that command/syntax checking will happen like in the scripts folder ?

  • Sorry I never added to this thread.

    The issue for me was taken care with R156 as shown in the release notes for that version.

    Possible runtime crash creating instances not placed anywhere in project (regression in r155).

    In R155 I fixed the issue by putting instances of all my objects on the layout and then destroying them on the start of the layout.

    Hope that helps.

  • I really like the approach of LoadScripts. I will change things over to use that instead of relying on folder order.

  • What I have found so far is that it groups everything alphabetically when adding scripts. So if I add a base class after I add the super class, it fails because the base didn't load. If I then create a sub folder called "A" and move the base class into that folder, it's not read before the super class and everything loads.

    Not sure if they'll give us more flexibility with this later on, but you can make it work.

    I have almost reworked my entire game into mostly JavaScript and that's how I worked around it.