O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up player health and lives

Any action game involving a player controlled character is likely to have some sort of "health" and "life" system. These are terms long used in video games that are used in conjunction with how your character is abstractly "alive" within the game itself. In reality, health and life in games are simply numbers whereby you lose a chance to play or even the game itself when they reach zero. GameMaker makes keeping track of these numbers quite easy when it comes to the drag and drop actions, so we're going to look at how we can add these elements to our player character.

Getting ready

Since this recipe involves making additions to your existing player character, you don't need to do much. You'll need a sprite to indicate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required