Kill Effect Using Particles

I want to make an effect that when the enemy has been killed, a particle effect will spawn to the center of the enemy object. I know how to make a particle effect and I know how to make the enemy deleted / killed. My problem is the logic on how the particle will be created when the enemy has been killed. Hope you help me with this simple problem.

So in my game, I detect if the enemy’s healthbar is smaller or equal to zero to trigger the effects.

This is what I did. When the enemy’s healthbar reduces to zero the corpses are spawned, the audio is played, the coins appear and the whole game stops for a few frames. All the other events of the enemy would be under the condition that the enemy’s healthbar is greater than zero. Additionally I added another variable called ‘death’ to distinguish the dead enemies and the alive enemies, also to let the effects only trigger once without using the ‘trigger once’ condition(it doesn’t work well when there are multiple instances of one object). Don’t forget to use the repeat-for-each events for your enemies.

Hope this can help you:)

1 Like