I have simple flying enemy in level, a flaming scull ( how original I know )… its behavior is when on screen with player, variable will change and if that is set to 1 it will follow player and try to hit him. This works fins as is. However I want also to play single death sound every time the skull is killed, and this does not work… if I set it to trigger once, it triggers perfectly once for the first instance and not after… if its without that condition it keeeeeps triggering non stop after death of enemy… I’m also not sure about the damage animation, it works but not sure if that’s correct way to trigger it and get out of it.
What is the actual result
Sound is either played in non stop or just once for first kill
i don’t recognize the “is dead” condition. is that from a behavior? what kills the skull? i’d think you’d need an object variable to trigger the death sequence, then do a “for each firescull” to test the object variable and trigger the sound and death animation.
Ah I should mentioned it. Its from “Health” plugin. There is a bullet plugin as well, bullets on collision do damage to pre set health pool, and when its 0 the “is dead” condition is true for the object.
For future reference if somebody come across the same… I have given new variable to object “played_death_sound” and set it to False
Than there is a global check for death and to change animation, fall to ground, and deactivate it as platformerObject. This kind of feel wasteful though, since its running every frame constantly setting this for death objects…
Than I have loop with “for each instance” where I’m checking “is it dead” and if the “played_death_sound” is false meaning it died, but did not play the sound yet. Then it will play the sound and set the “played_death_sound” to true
This works, not sure of its correct way to do it though…