Health bar growing too long!
JCFord
Member Posts: 785
Following QuantumSheeps's Video, I have made a nice health bar that gradually shrinks over time, my player can then collects health point which increase his health back up.
Is all working nicely, the health bar drops over time and when my player collects health points it increases the health bar, but the problem is if my player collects a lot of health bar points the bar grows longer and longer going off screen, I need a way to cap it at 100% so it can't grown anymore.
Been playing around with different attributes such as
IF game.energy > 100 then
change game.energy to 100
But it doesn't appear to work?
Any ideas or advice?
Is all working nicely, the health bar drops over time and when my player collects health points it increases the health bar, but the problem is if my player collects a lot of health bar points the bar grows longer and longer going off screen, I need a way to cap it at 100% so it can't grown anymore.
Been playing around with different attributes such as
IF game.energy > 100 then
change game.energy to 100
But it doesn't appear to work?
Any ideas or advice?
Comments
change game.health to game.health+20
min does all that in one step?
Basically, you give the MIN function two choices, and it picks the smallest one.
It's an easy way to set limits on things - the second choice is usually the max limit of the attribute you're tracking.
MAX is the opposite, and can be used to set minimums on attributes.
Essentially it does what you just said, but eliminates that extra rule.
Joe
My health bar was growing longer than Pinochio's nose, lol!
Just thought I'd mention it as it may be of use to others :-)
Then I made the attribute 'health' an integer and and when health = 5 (for example) it would change the image to health5.png
This seemed to work for me but that 'min' thing could be useful