Hello guys!!
I’m developing a little game in my spare time, it’s in a very early stage and i’m still making the health and attack system. But i’m having an issue with the enemy’s health system…
The print screen of my code is in the attachments, but here’s how i did it(logically):
1 - When the character(Guerreiro) is colliding with the enemy(Caveira) and the animation of the character is the attack one so it shoud apply a force to the enemy(Caveira) and add 1 to the enemy’s health variable(Life_caveira)
2 - When the health’s variable of the enemy(Life_caveira) is equal to 3 so it should delete de enemy from screen
That’s how i did it but when i attack the enemy the gdevelop just delete him instantly. I’ve noticed that when i press the attack button really quickly it doesn’t happen… My theory is that when i press the attack button the collision last so long that the enemy’s health variable is filled to the value i’ve set to the object to be deleted.
I don’t know how to solve this but i guess that must be a way that when i press the attack button it should act as only one collision for attack…
Can anyone help me?
Thank you guys!!