lives (deprecated)



Returns: Real


This variable is global in scope and is used to hold a numeric value which is usually used for the player lives. Bear in mind this is not necessarily always the case - just because it's called "lives" doesn't mean it has to be used for the lives... it can hold any real or integer value you wish for your game.

IMPORTANT! This variable is only included to support legacy projects from previous versions of GameMaker and should not be used in new projects as it is deprecated and in future versions or updates may be removed entirely.


if place_meeting(x, y, obj_Enemy_Bullet)
   health -= 10;
   if health <= 0 lives -=1;

The above code checks the current instance to see if there is a collision with the instance of the object indexed in "obj_Enemy_Bullet", and if there is, it removes 10 points from the global health variable and then checks this value to see if it is less than or equal to 0. If it is then the instance removes 1 from the global lives variable.