How do I counter the tick delay for "on animation finished"

0 favourites
  • 11 posts
From the Asset Store
Make a displayed number gradually increase or decrease, making an impression of a real-time counting.
  • Hello

    So I am using a "on animation finished" trigger

    I can't figure out how it's working really and I am confused.

    It seems that 1 tick before the animation is actually finished, the event "on animation finished" is triggered

    So in my case for example, I have :

    On A "prejump" animation finished :

    set A animation to "jumping"

    then I have another condition saying :

    when A "jumping" animation is playing

    set A value to x

    What happens is that during 1 tick, A still has "prejump" drawn on the screen but A value is already to x, but its animation is not set to "jumping" yet.

    I tried to put everything in the same event like this :

    On A "prejump" animation finished :

    set A animation to "jumping"

    set A value to x

    But it does the same.

  • Do the first condition

    On A "prejump" animation finished :

    set A animation to "jumping"

    Followed by a new condition

    system > compare two values > first value 'A.AnimationName' equal to "jumping" > the set value action

    else > set the value differend

    Assuming that there will be only 1 A playing those animations.

  • Ah yea

    thanks so much !

  • Hey 99Instances2Go

    So I had this whole thing working using your way, and then I just bumped into something crazy.

    Basically I have copy pasted my thing and literally just changed the input, instead of using the controller it's using the keyboard now, for the exact same thing. But it wasn't working !!!!!!!

    I have noticed that now it's changing the name of the animation on the same tick than the tick where you press the button, but both keyboard and controller are using the "on press" trigger. And when it is with the controller it's changing the animation the tick after you actually pressed the button.

    Are the controllers and keyboard not behaving the same way ? is that a bug of Construct 2 ?

    EDIT : ok yep, I just tried it in an empty project. If you make two sprites and switch their animation on a "on press button" trigger it is not going to change at the same tick depending of keyboard or controller

  • This is the difference between an actual trigger and a fake trigger.

    "on key press" is an actual trigger and is triggered when the key is pressed.

    "on button pressed" is a fake trigger and is the same as

    "button is down"

    "trigger once"

    More info here:

  • okay!

    Thank you so much R0J0hound

    well, that's very good to know that. I guess I can remove my bug topic then.

  • Hello R0J0hound

    And by the way, just curiosity but, is there any way of "simulating" a "real trigger" with events ? Like to fire an event like "on key pressed" does ?

  • Functions are the typical way to do that, unless you had something else in mind.

  • Hello R0J0hound

    Yes, I mean a way to activate the event as soon as the trigger is triggered :

    When you pause the game in debug mode, and trigger a "on key pressed" button, it will trigger the event and if there is an animation name to change or a variable to change, it will apply those actions at once.

    Whereas with a function trigger or every else "fake triggers" such as trigger once, it will wait until the end of the current tick before applying the actions.

    My question is : is there a way to reproduce the first behavior for another object with events ?

    Also it brings me to another question :

    I wonder if that's only me but, it seems that I can't make the events such as "key is down" working in debug mode although "button is down" works with the controller events. I guess this is related as well ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That may just be a limitation of the debugger that "on key pressed" events still run when paused. Functions are actual triggers that will run right when you call them, but they won't be called when the debugger is paused.

    I do not know with your second question. I do not have much experience dealing with input while in the debugger.

  • I also encounter that If you have a large event sheet for one of everything and you try to do function at way the hell at the bottom let say event line 1 is calling for a function for a event line of 200. Then it just takes a tick or two more to find it while everything else is going on. So id suggest just to create an event sheet for the function at that point never had a problem after that.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)