Overhealing with max hp
raze_struck
Member, PRO Posts: 141
I have 2 attributes current hp, and max hp.
When x is pressed and max hp > current hp+50
change current hp to current hp +50
heal.
however, I want to make it so that if max hp < current hp + 50 and x is pressed, then current hp to change to max hp, but I can't simply change the integer attribute, because I just want to increment current hp, not change it over to max hp. (?:S)
Comments
bump
bump
I just put in a second rule that says If Current HP >Max HP, Current HP = Max HP. Its separate from the hp gain and is a constant policing of the value.
Are you wanting to prevent overhealing? If so, do this:
When x is pressed Change attribute game.currentHP to min(game.MaxHP, game.currentHP+50).
The min() function returns the lower value of the arguments so it will ensure that game.currentHP never exceeds game.MaxHP.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User