I have an attack in my game. On collision with enemies, it is supposed to make a sound and to subtract damage from the enemies health variable. Usually it doesn’t play the sound or subtract from the enemy’s health though it is obviously in collision. In this clip below, you can see it is obviously hitting the enemy (and activating their hit flashing animation), but it isn’t making the sound or doing the damage. Any idea why?
Hi there. We would need to see the events related to this to know where the error(s) might be.
Here is the unconditional action that separates them:
I see that you have not assigned a volume value to the sound, therefore, it will not have volume.EDIT: I think that by default the value is 100%, in that case this would not be the problem.
You should be careful with the constantly repeating events (note that for every frame where “TK” is in collision with the enemy, the enemy’s “Healt” value will be subtracted and the sound will be played). Maybe you need to add a “Trigger once” in the conditions.
Does that same sound file work if you embed it elsewhere in the game? Is it compatible to be reproduced in Gdevelop?
Maybe you need to put it under a repeat for each instance of Enemies
The hit does register sometimes and I hear the sound and the damage is taken off. Other times, the enemies are knocked off the screen and don’t take any damage. Will try “trigger once.” Thank you.
I figured it out. I had the collision as a sub-event on a timer. I think it was only registering the hit if the timer was exactly right. Sorry and thanks again!