Chapter 2. Implementing Counters and Health Bars

In this chapter, we will cover the following topics:

  • Implementing a score counter
  • Implementing lives counter
  • Creating a modular coin counter
  • Creating a symbolic lives counter
  • Implementing a linear health bar
  • Implementing a radial health bar
  • Creating a health bar with armor
  • Using multiple bars to make a multibar
  • Developing a kingdom hearts health bar style

Introduction

This chapter explains how to implement counters for keeping track of variables such as score, coins, and lives, and how to display them through texts or through more complex things such as health bars.

We will start by creating a counter for our score and we will proceed with more complex counters.

Later, we will introduce the concept of health ...

Get Unity UI Cookbook 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.