[Solved] HP bar for enemies

I need a way to show the HP of the enemies in my game. Enemies need 5 hits to die.

I created an animation separate from an HP bar.

I need to make each HP object follow its own enemy.

Similarly, I would need to pass the enemy’s HP to its respective bar.

It is impossible to create the health bar directly on the enemy’s sprite as it has many different actions and different sprites.

I need a light while I solve other things here!

forget to do the enemy HP bars part of the animation. it is possible, but unnecessary.
just give a simple rectangle to each enemy. than set them position to the appropriate enemy. if you do this “always” the bars will follow the enemy objects. but of course, this isn’t so simple, but not terribly complicated. you need a few variable to this.

however in GDevelop is exist an object linking function. I couldn’t use it yet, so I’m not sure what is it for, but may be that’s what you are looking for.

1 Like

Object linking is what you want. Create each enemy object and hp bar and link them in the same event. Then create an always true for each event that for each enemy : 1 take in consideration the linking 2 set up bar position to enemy.x and enemy.y+a number.


Thanks arthuro555, I got what I wanted by linking the objects.

God bless you!

1 Like