How do I make enemies animate separately?

  • Fairly simple question but something that has stumped me regardless. Here's the situation:

    The sprites for the test enemies I recently placed in my game are tied to an object called "hitbox_test_enemy", and at the start of each layout they are spawned like so:

    Doing this creates a "sprite_test_enemy" at the position of each hitbox and sets that sprite to the position of the hitbox that spawned it. However, I don't know how to make the different "sprite_test_enemy"s animate independently. Whenever one animation is set to play on one, it affects all of them. How do I make it so that my "set animation" events (such as when the enemy is hit, dies etc.) only affects the relevant one and not all of them?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never mind, I figured it out. I placed the sprite object in a container for the hitbox object and changed my code to look like the following:

    Then I did this:

    Instead of just having them outside of the "for each" event, which was what I had before... and now they animate separately! I know the standing/airborne variables seem a bit redundant, but they're used independently outside of these two events for the enemy so they're both necessary there.

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