Hey guys,
Long time lurker, first time poster.
I've built a patform game and I've just implemented health pickups.
Throughout the game you acquire hearts which add to your overall health.
Problem - When I 'pickup' a health potion, I can't figure out how to add to the health depending on how much
the player has acquired.
Ie; If the player has 6 health, but the potion gives you 3 and the player has a max 7 health.
How do I make it so theplayer only gets 1 health from the potion, making player health variable not go
over max health 7?
I hope explained that properly ! I have two variables, player health - the variable governing enemy damage, death and the darkening of acquired hearts.
And Health Marker variable, the variable governing how many hearts are acquired.
Please help I'm finally stumped :8
When you acquire the potion, do this:
Player: set health to clamp(Player_current_health+normal_quantity_the_potion_will_regen, 0, Player_max_health)
See the manual for more details on the clamp expression: https://www.scirra.com/manual/126/system-expressions