SOLVED: enemy / multiple hits

i’ve done the tutorials on how to shoot an enemy and then the enemy is destroyed and disappears with one hit. how would i make it so that it would take multiple hits to destroy an enemy. my current set up is this:

Just give the enemy an object variable like “hits” and then instead of deleting the enemy object when it collides with a bullet you deduct 1 from “hits” instead. Then you create a new event that has a condition of variable hits of enemy =0 which you give the action of delete the object enemy.

Another approach would be to give the enemy more than one animation (e.g. you could have it being increasingly damaged or bloody) and increase the animation number with each bullet hit.
If you wanted it to be killed after three bullets you would create an event whose condition checks if the animation of enemy>3 and if it is, delete the enemy object.

thanks for the info! i edited the enemy object, variable: life and value: 2 and then added this in events:

however, enemy is still deleting after one hit? not 2? any thoughts, anything else I should add?

Maybe because you’re not deleting the bullet object each time, its causing multiple, simultaneous hits which triggers the 0 life condition…?

Move the bullet deletion action back to the collision event and see if that works.

hi,
I don’t see full hit code but add trigger once if not it triggers on the loop every frame so your varibale gets 0 i nless than a second

BWPanda - works perfect, thank you! updated the event to:

xisco- thank you i will try to update that too!

Hi, I want to apply this solution for my game.

I have enemies object and grouped it into Enemies.

For now I set object variable EnemiesLife = 2 to my BigRedEnemy (because I want that enemy to be hit by player twice).

Now look at the attached picture (sorry for the picture I took it with my phone just zoom it)
It’s an events for collision between player and enemies.

Does my conditions is right? Because it’s not working, BigRedEnemy still get deleted when player fell to that enemy once.