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 bars and we will also learn how to change their look, so that they are more linear or radial.

Finally, in the last three recipes, we are going to implement very special and complex health bars, which are suitable for bosses, for example.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.66.31