How do I check if the current animation is one in a list?

0 favourites
  • 7 posts
From the Asset Store
you can add, remove and reorder list items and many more
  • As part of my state system, I need to check if one of a couple different animations are playing, and if so set the player's state accordingly. I can figure out which animation is playing, but how do I check if it's one on the list? How do I make that list in the first place? And then setting the state I think can be handled by just setting it to the animation name, which I can already do. Thanks for the help!

    tldr; How do I make a list of animation names that I can access in the event sheet, and how do I check if the current animation is in said list?

  • Would just putting all your animation conditions in an OR block work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For the list, learn up on arrays (1D array=list).

    For checking if it's one in the list (array), use a For each loop to compare the animation name that's playing with each array item.

  • Codah, thanks, but I already knew that was pretty much what I needed to do. I guess I should clarify I'm asking about the specifics of where in Construct do I find an array to put into an event sheet and then how exactly do I set up the for loop?

  • Codah, thanks, but I already knew that was pretty much what I needed to do. I guess I should clarify I'm asking about the specifics of where in Construct do I find an array to put into an event sheet and then how exactly do I set up the for loop?

    Yes specifics help. People asking the same question can mean very different things.

    Right click on Object Types, choose Add new Object and choose "Array". You can add more than one. You can rename it. It will default to a 'list' length of 10 (i.e. Width of 10) if you look at its properties under Object Types Properties. Now read https://www.scirra.com/manual/108/array. Basically "Array:Set value VAL at POS" will set an item in the list.

    Use Array:For each element to go through the array, comparing CurX with your value. Again, read the above section for details of using For Each. There's no need for me to retype the manual <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> After reading, ask if you have any problems.

  • Thanks codah, this worked great. Reaaally speeds up writing the animation system

  • Thanks codah, this worked great. Reaaally speeds up writing the animation system

    Glad to hear it

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