Hi guys
I'm trying to create health bars for enemies in this learning project, however, I'm encountering a problem.
When the health bar reaches 0, the enemy should do its dying animation and get destroyed, however this is not happening, and I think I have narrowed the cause the the fact that somehow there are 3 health bars attached to the monster, instead of one. The issue is that I don't know why there are 3 health bars, I have attached a screenshot below for you guys to check, as I've wasted more than an hour myself trying to understand what is going on.
On monster created, I have a sub event with a for each loop and a trigger once condition for creating the health bar above the monster sprite. As a separate event, I set the position of the health bar to the monster's position, and set its width as the HP variable from the monster. When the health bar reaches 0 (or below), it is destroyed.
I have also set a state for the monster stops the platform behaviour, sets the "Explode" animation, upon its finish. the monster sprite is destroyed. This is then tied to a condition below where it is actioned when the monster HP is less or equal than 0 (as damage received can take the HP into the negative).
As in the screenshot attached, I don't see where the other health bars are coming from. The all have the same position (I clicked on them in the debug page).
https://i.imgur.com/myD1FsO.gif
Can someone please explain what am I doing wrong here?