(Solved) Link health extension and health bar

Hello everyone!

Is there a way to link health (extension) and health bar?

so I don’t have to manually add width to the health bar when I add health to my character?

I also wanted to save these values to the next scenes. But I don’t have any idea how. If anyone could share their ideas I’d be so grateful.

You can use the expression builder for that. It is the blue button with the ∑ symbol and 123. Go to: Game mechanic → Health points and damage → Health → Health points. Then you just have to choose the object whose health points you want to use. In your case the expression will look like Neu.Health::Health().

You need to use global variables for that: Global variables - GDevelop documentation

1 Like

Thank youuuuu. I’ll try that.

I found out how to link them: Neu.Health::Health()/Neu.Health::MaxHealth()*314

314 is the width of the health bar.

Thank you Drona!

1 Like