Animate multiple enemies with separate collision..

0 favourites
  • 3 posts
From the Asset Store
Full source code to the game guardian. Includes all art and music assets.
  • So, I have a spawnpoint, each one spawns an enemy collision, then a sprite which it pins to the collision.

    I want to change the animation of each sprite when its associated collision is moving (8 direction). I've got the movement working fine, they move as individual enemies but yet the problem is that they will ONLY change the animation when ALL instances of the collision are moving, and ALL instances change their animation, not just the ones that are actually moving.

    What I want to do is have a sprite animate ONLY if the collision it's pinned to is moving.

    I've tried assigning an ID instance variable and checking the sprite's ID matches the collision ID and it still works the same way.

    Any help would be massively appreciated as this project WAS going so well until now! Thanks!

  • I think this read can help you: http://www.scirra.com/tutorials/361/understanding-uid-iid-health-of-enemies-and-rocket-smoke-trail

    Plus, you have to deal with instance variables. Make one instance variable for each individual object you want move separated.

    By checking their ID, only the designated ID will go ahead with the code, and if more than one have their conditional meet, they will have separated instances working in parallel.

    I can't think in other phrase than "encapsulating the event" for this type of solution ^^

    Feel free to ask more, or share your CAPX and we can make the deal for you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oddly enough this worked, while I was doing something very close to this which should've also worked in theory.

    Anyway, nevermind it's working now - thanks for the help! :D

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