Hi, I would like to use behavior health to create a health bar. Is there any way to “recover” the behaviour health value and use it to change the length of a “health bar”? I tried using a variable, with the same starting health value, but as the game progresses it gets totally inaccurate .
there is also a health bar example in gdevelop. although i havent used the behavior health i can help with variable health bars what do you mean it gets inaccurate?
Thanks for answering. Yes, I saw the health bar creation tutorial, my current one was made based on it. The problem is that I created a boss that fires a quick flurry of fire, and when the character is hit over and over quickly, the gauge is fading and fading well before the behavior health actually goes to zero. I believe the problem is the “delay” when the player is hit, in behavior health there is a delay option to prevent health from dropping continuously, without stopping. But the variable-based health bar has no delay at all, so every shot it registers and shrinks, even if the “true” health hasn’t shrunk. That’s why I commented on recovering the “real” health value, as it would avoid this delay issue. The other option would be to simulate the delay in the health bar, I didn’t know if it works. I don’t have this problem with other enemies in my game, because they fire individual shots, so it doesn’t compromise the health bar.
i had the same problem found some solutions while messing around
for the continuous attack if the object is unique which it is since its a boss you can simply use the extension Repeat X to+ a timer to continuously reduce a players health at whatever interval you want it as the health bar will update and will not drain like crazy. Id use that instead of the player invulnerability time in the health extension
if the objects are not unique you can see the thread i posted below which is the better solution
I think gdevelop could use the simple “Wait” type of command as it could solve many of these problems without messing with separate timers so often