What is causing the health bar to lose all its hearts? [problem solved]

What is causing the health bar to lose all its hearts?

Greetings! Right now i am working on a game and trying to add a health function, what i am trying to go for is making JerryTheBlob (the player) lose one heart when he collides with ENEMY and blink for 1.2 seconds.
But the problem is that instead of what i just explained. Everything works except for the health bar instead of losing one heart each hit, it loses all of them
So if anyone knows, please tell me what i’m doing wrong.

How much is the damage cooldown for JerryTheBlob?
and how much health does JerryTheBlob have?

The cooldown is 1.4 and the amount of health is three hearts

It looks like it’s deleting the health from the status bar value. Should it be heart bar value equals health instead of minus health?

1 Like

This is the solution.

I thought it shouldve been minus health because when you get one heart is supposed to get removed

Is it working now? As long as the health and number of hearts is 1 for 1, you should be fine.

Thanks! the code is working now!

1 Like