I tried it, but it still doesn't work. Here's what all my events for the healtbar look like:
Event: Player: on collision with enemy
Subevent: Healthbar: Animation frame<4 Action: Healthbar:set animation frame to Healthbar.Animationframe+1 Action: System: subtract 1 from Health
Event: System: Health = 0 Action: Restart layout.
I don't know if you'll be able to understand that or not. And the Health thing is my global variable. Thanks.
Let's say you have 5 frames and 5 health, the basics would be to set animation frame to health, because they are same frame 5 is full health (5) for example.
If it's more a percentage or other values, you create events to set animation frame based on the amount of health you have. On collision with enemy you can subtract from health, but you don't need to put the animation health bar events also in there, they should be separated out so it's easy to understand, for example if health > 80 then set health bar animation frame to 5.