Guys, I'm having a lot of headache trying to get rid of an annoying bug that is happening with the lives system of my game.
So I'm here humbly asking for your help! q.q
The player sprite have a boolean that sets when it dies. This boolean is activated everytime player sprite touches an enemy sprite.
The boolean activated triggers a death event, that substracts 1 from a global variable "Lives"
and there is an game over event, triggered when the global variable "Lives" equals zero.
the "vulnerable" boolean is used to make the player invulnerable when it is carrying eggs
<img src="http://i10.photobucket.com/albums/a126/shinobi_br/lives_problem_zps013ff013.png" border="0" />
Now here's the problem, sometimes, when 2 enemies touch the player at the same time, or when a enemy touches the player twice (for example, touches it when jumping and once again when falling), 2 lives are substracted instead of one. Also, sometimes, if this happens when you have 1 life left, it starts counting negative, instead of 0, for consequence the player gets stuck at the stage.
I tried to disable the collision at the moment player touches an enemy, but still, the problem persists.
Any ideas about how to solve this? I'm getting crazy with it! (????)?? ???