Having the hardest time with enemies...

This forum is currently in read-only mode.
From the Asset Store
Time rewind like in "Braid". Choose objects that will be affected by time rewind
  • So far, I'm having a problem giving them a consistant "explosion" before dying. I thought that generally, most enemies would have the same "death explosion", but a few enmies would have unique ones, like if they were a bird, some feathers would be scattered in the explosion. For a slime, little droplets.

    I'm trying this with a test enemy, but I think I must be doing enemies completely wrong. With two of this test enemy, there are numerous problems trying to get some consistancy. I notice that the first instance of this enemy I kill, they just disappear. No death as intended. When I kill the second, there IS a death animation.

    I think this is because I've made two of the same collision box, two of the same enemy to paste them to. This is what I think is causing the problem: There's an "Always" condition, telling the enemy to stick to the collision box's XY position. When the first enemy dies, instead of playing the death animation, it goes to the next available collision box, hence the instant disappearing.

    Is there a better way to handle enemies so I can give them their own death animation, or should I create a seperate object for the death animation? And just have the enemy spawn that when health reaches 0? I'm assuming it might be best to create a seperate object for death animation, huh?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Separate object for death animation seems to be about the best option available.

    I have sounds playing when mine die, but now that I am going to have different monsters I have different animations set for different monsters. You could always import an animation to the enemy sprite, and have a death animation trigger on death.

    Should work just as good as long as you are using private variables correctly.

  • I use a private variable called 'state' for things like this.

    State 0 for me usually means it just spawned, so I have a For Each, if state == 0, do setup things here. Then I switch the state.

    For you, just set the state to -1 or something if it's supposed to die, and have a if state == -1 and death animation is not playing, play death animation.

  • I actually tried an experiment of "states", seeing some other games use that for characters and enemies before. It didn't seem to make any difference. I also used a "If Defeated animation is NOT playing" condition for "Stick Enemy to Collision Box XY", but that didn't work either. The sprite still seemed to stick to the nearest collision box.

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