Why is the enemy hit sound triggered in the game script?

As per the title.

Why are induvial enemies not responsible for their own sound on death like the player shot sound? Is it just a preference or is there a technical reason for it?

I know from Unity that if something is removed from the game world any sound it has playing is also removed (because the sound playing node is a child of the thing being removed) but is it the same with Godot?

1 Like

yep thats spot on, if the enemy were to play its own child audiostream , once the enemy root node is destroyed, then all its children will go as well, and the sfx wouldntt have time to play.

the only way around it, if you wanted the enemy to be in control of its own audio, would be to have it create an audio stream player and have it on the root of the scene.

this is something thats covered in the martian mike section with regards to jumping sounds.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms