Learning Outcomes

By the end of this chapter, you will be able to:

Add a health system to the game.

Over the next two chapters, we’ll be creating a health system for our game. Let’s define how we want it to behave:

We’ll assign a number of hit points to the player.

Every time the player is hit, they lose 1 hit point.

There will be a number of health pickups scattered around the game world.

When the player walks into one of these, the health pickup is destroyed, a sound effect is triggered, and the player regains a hit point.

When the player is down to a single hit point, a fast beating heartbeat will be heard.

When all the hit points are lost, Unity will load a “Game Over” Scene, with an option to restart ...

Get Game Audio with FMOD and Unity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.