How do I apply an animation change to a single enemy?

0 favourites
  • 4 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hi all.

    I'm just starting out in Construct and I used the Platformer tutorial as a basis for my project and am trying to expand upon that.

    In this particular instance, I am trying to set it up so that when an enemy is defeated, their specific animation changes to the 'Death' animation (the eye becomes an 'x') and they fall off the screen.

    The issue I'm having is that I can make the hit enemy falls off the screen just fine, but the 'Death' animation ends up being applied to rest of the enemies (the ones who haven't been hit yet).

  • Construct is about picking on the left and applying actions to those picked on the right. You didn't pick any BrownBox so it applies the animation to all. BrownBotBox is a different object so they don't relate. The reason it falls off screen correctly is because you picked the BrownBotBox on the left (on collision with) so it disables the collision for that one only.

    With this particular event you could add a condition 'BrownBox is overlapping BrownBotBox', this would correctly pick the one you want to set the animation.

    There is also something called a 'Container', if you put BrownBox and BrownBotBox in a container then they would relate in events, this avoids picking but it's also good to be aware of picking as described above.

  • Thank you! In the tutorial they have it set up to for every tick, the PlayBox's position is set to the Player Animation. I thought I could do the same thing to link the enemy animation to the enemy collision box, but I can see now why that wouldn't have worked. I created the container and it's now working as intended :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great! Container works for how people imagine Construct would work, that when you reference the collision box it automatically picks the visual sprite that relates to it. Container builds this link so you can pick either of the objects and then it'll know the other one. They are created together and so automatically relate in events as though they are one combined object.

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