Multiple life bar is eliminated as soon as an enemy dies

hi guys, i was trying to put a life bar on my enemies only that when one of them dies the life disappears to all the elements in the field … I turn my code with the hope that someone can help me.
in the code there are no deletions of hp bar and hap text because I have tried them all if someone knows how to fix … I was trying with links between two objects … I don’t know how to do it anymore

1 Like

I don’t think I understood your question very well (English is not my native language) but have you tried inverting the order

of: Take into account all Hpbar linked to boss
to: Take into account all boss linked to Hpbar

I guess you’ll have to use “take into account” to delete the those elements as well.

Once I was having problems similar to yours, and it took me a whole day to fix it, it only worked after inverting the order.

(Sorry if it doesn’t help you out, I am a new Gdevelop user, I hope someone more experienced help you out as soon as possible)

To add a lifebar to each enemy you need to do it in a Foreach then use Link two objects, and link the lifebar and the enemy

i.e. Logic
Foreach obj_enemy
Crate obj_enemy at X and Y
Create lifebar at obj_enemy.X() and obj_enemy.Y() + 10
Link lifebar to obj_enemy

Later when you d the enemy movement logic you need to get the enemy and lifebar
Foreach obj_enemy
Take into account lifebar
Move enemy
Move lifebar

thank you so much guys! I followed your instructions and finally succeeded

1 Like