How do I navigate between animations

0 favourites
  • 6 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • How do I navigate between animations with a previous and next button?

    I do not want to work with next / previous frame. I named my animations as a0, a1, a2, a3, ...

    Now, I would like to go to the next animation or go to the previous animation.

    Is there any command to navigate this way as used in next / previous frame? if not, how could I do it work?

    (I hope I was clear with my doubt, tks!)

  • On Next - > Set Sprite Animation to str("a"&int(right(Sprite.AnimationName,len(Sprite.AnimationName-1)+1))

    On Previous - > Set Sprite Animation to str("a"&int(right(Sprite.AnimationName,len(Sprite.AnimationName-1)-1))

  • Hi, oosyrag,

    This error occurred

  • Oops messed up my parentheses, try:

    On Next - > Set Sprite Animation to str("a"&int(right(Sprite.AnimationName,len(Sprite.AnimationName)-1)+1))

    On Previous - > Set Sprite Animation to str("a"&int(right(Sprite.AnimationName,len(Sprite.AnimationName)-1)-1))

    Don't have the program handy to check right now. Let me know if it works.

  • I tried this command:

    Set Sprite Animation to Sprite "a"&int(right(Sprite.AnimationName,1))+1

    its work!

    Thank you oosyrag, this chat has cleared my mind.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yup, that would be the simpler one, but watch out if it goes past 9, that wouldn't work.

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