How do I wait for a framenumber before changing animations

0 favourites
  • 5 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • I am looking to wait until an animation runs through it's entire frame cycle before changing to another animation.

    The first animation is on a loop and has 18 frames in it's animation.

    At any point the second animation may trigger, and I need the event to wait until the first animation gets to 18 before it sets the new animation.

    Is this possible?

  • You can compare the frame number and there is also a "on animate completed" condition. Either of them could be used.

  • Can you show me a quick example of the loop you would do to achieve this?

    I am thinking when animation change is triggered, wait until frame = 18 then set new animation,

    I am uncertain how to do this loop in construct 2

    Also when looking through events I was unable to find the on animation complete in the list?

  • What about if you give the sprite an instance variable (text) and call it something like newAnimation. Then in events:

    • when you want to trigger animation 2, ie a shooting animation: set sprite.newAnimation to "Shooting"
    • first animation frame = 18 & sprite.newAnimation != "": set animation to sprite.newAnimation, set sprite.newAnimation to ""

    Basically every time it gets to frame 18 in animation 1 it checks to see if you've put the name of another animation into the newAnimation variable - if you have, it plays the new one and blanks the variable, otherwise, nothing happens and it keeps playing animation 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks mikehive, worked a charm

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