Eat healthy foods and exercise
Offline
I suppose you meant in Scratch, so: It's as simple as creating a variable for health, and keeping track of it.
When the game starts, you reset it to a certain value. When the player touches an enemy, it's life is decreased. If the player's health reaches 0, game's over.
when gf clicked set [Health v] to [100] forever wait until <touching [enemy v]?> change [Health v] by [-10] if <(Health) < [1]> broadcast [game over v] //you decide what to do here. end wait until <not <touching [enemy v]?>> //so we don't lose too much health. optional. end
Offline
Use a variable for health.
Offline