DiegoM's Forum Posts

  • Have you tried opening and closing your project in the latest beta? Just to verify if the problem still happens in that version.

    It is possible the problem has already been fixed. If it is fixed in the latest beta but you don't want to use beta versions, you will have to wait until the next stable release.

  • When you draw a tile, a model is created to represent it, it mainly has the position and the index of the tile. Those models are never actually deleted after creating them because it is infinitely easier to keep them around than figure out what needs to be recreated and with what information depending on what changes.

    Since the tile models don't hold any image data themselves they are rather lightweight memory wise. They could probably be made to be more compact if they where represented in some unorthodox way (thinking about storing all the information directly in an ArrayBuffer instead of a class so all the bits can be packed as neatly as possible and using static methods instead of class methods to reduce the memory footprint even further), I don't think it's worth the trouble though.

    When it comes to drawing, only the visible tiles are looked at, so that part is as efficient as it can be.

  • I think in the first snippet, the problem is a misunderstanding on how those events work.

    The mouse event is a trigger, so it is only executed when the left mouse button is clicked. So far so good...

    The following event is not a trigger, so it is executed every tick. That means that as soon as CanAttack is set to false the first time, the actions for CanAttack = false start executing every tick.

    So every tick you have this timer being setup to wait for 1 second and after that setting CanAttack to true.

    The problem with all of that is that by the time CanAttack is set to true the first time, a whole bunch of other Waits for 1 second actions have also been set up, and after each of those finishes, CanAttack will be set to true, making it seem the clicks are not setting CanAttack to false.

    If I understand correctly, to get the behaviour you want, you need to place all the actions in the Mouse trigger. That way CanAttack is set to false, then you wait for 1 second and after the wait is done you set CanAttack back to true. Because everything is in the trigger it will only happen when the mouse is clicked.

  • If you don't want to share your whole project, try removing as many things as you can from it, while still reproducing the problem.

    If you could share a trimmed down project, it would help a lot to solving this.

  • The crash suggests that there is a problem loading the state of a tween or a timeline. So maybe it has to do with a save being done while a tween or a timeline is playing and then there is a problem restoring that state.

    That might explain why it doesn't happen consistently... I am just guessing though, so the conditions that cause the crash might be different.

  • Can you share the project, and give steps to reproduce the problem?

    Without that it's very hard to figure these problems out.

  • As for criteria when arrays and generators are used... I think our Javascript API is just a little bit inconsistent in that regard, so you'll have to work with what you find in different parts.

  • The children method returns a generator function

    developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator

    The result of a generator function is an iterable that can be placed in a for of loop just like an array would.

    const ObjectA = runtime.objects.ObjectA.getFirstInstance();
    
    for (const child of ObjectA.children()) {
    	// Do things here
    }
    

    That is the most common way in which you will use generator functions and likely won't need to know more than that. If you want to know more about them I recommend looking at the MDN documentation.

  • I just tried using the new instance signals to get around signals not directly receiving parameters and it looks like you can set up what is effectively and Event-based observer pattern.

    At the end of your function create a new instance with the "Create Object" action, set any instance variables you want to be available in the "On Signal" triggers and then have the newly created instance fire the signal.

    The instance will then be available in the trigger with all the instance variables that where set.

    After firing the instance signal destroy the instance to save memory.

    It's pretty much the same as creating an event and then have a dispatcher fire it in traditional programming languages.

  • Maybe I am misunderstanding this so if this doesn't make sense don't think too much about it, having said that...

    Have you tried adding a Signal at the end of your function? You can then have different "On Signal" triggers in different event sheets and each can do different actions.

  • I haven't really been able to look at any of this, but thanks for the additional info.

  • Someone pointed out that Advanced Minification is causing problems and I was able to confirm this, still trying to figure out what the problem is with the new Cordova plugin we are using.

    If ads are not showing for anyone trying this out, try using Simple or None minification.

  • This has to do with a browser extension.

    Try disabling all extensions to quickly check if it solves the problem.

    After that you can disable extensions one at a time, until you find out which one is causing the problem.

  • 5 MB might not seem like much, but it can feel like it takes ages if you sit down to wait for it, specially in slower or spotty connections.

    Asides from building the UI with the expectation that a video is going to take a little while to show up (showing a spinner or some other kind of feedback where the video is supposed to go), you should also try to compress them as much as possible until they have an acceptable quality.

    Another common strategy is to start loading videos as soon as you can, while the user is busy paying attention to something else or getting to the part of your app that needs to show the videos. This way you get a little bit of "free" loading time, by the time a video actually needs to be shown, the perceived wait time can seem lower.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see what is going on.

    Set Time changes the timeline time, and it also pauses it there, which means it can be taken out of the pause state using the Resume action.

    In the case of setting the time in the same action block as the timeline is played, the the timeline should start playing from that point in time without the need of explicitly calling Resume.

    I say it SHOULD because it's not doing that! For now you can place a Resume action right after Set Time and it should do what you want.

    I think I will change the behaviour of Set Time because it's a little bit strange that it stops the timeline and it's not very useful either.