Hi ! I have a problem in my project. Basically, I am creating a system which allow to ennemies to burn.
What I have done :
So I had already done a player, that can punch, but his main weapon is a flamethrower. Fire projected is made of particles. When he double jumps, there is also fire particles toward down.
Then I have made a family named "Fire" with all types of fire particles, and an other family, "Ennemies" with only one kind for now. Thanks to this, when the life instance variable fall down to 0, the ennemy die.
What I want to do :
I want to allow each ennemy instance to burn indivudally, when fire touch them, thanks to "Fire" family. Of course, fire have to follow ennemy, and disappear when he dies. The fire also hurt ennemies.
That seems simple in fact but...
Where I am stuck :
In my opinion, all that I have done is correct. But I steel have unsolved bugs that appear sometimes, and I dont know why :
- Fire can take some time to born, when an instance of "Ennemies" has the burning state on
- Other times, fire can simply dosn't appear at all. So the ennemy burn and dies, without particles of fire.
- And the worst... when a instance burn, others can turn to burning state, like if they were linked in a way that i don't understand.
To do this, I created a instance variable called "is_burning" (0 = false, 1 = true. Don't know why i don't take a boolean). When a kind of "Fire" family particles touch the sprite of the ennemy, the burning state is turn to 1.
When "is_burning" equal to 1, an instance of "ptc_fire3" (fire particles of a burning ennemy) is created, if there isn't one already. Else, the fire is constantly moved on the burning ennemy. And when a ennemy's life fall down to 0, fire is destroy if he is overlaping it.
Or it's as I understand it, because that doesn't seem to work.
Thanks you for helping !
I will give you the link of the project in comments but too lazy to do it tonight.