Book Image

NGUI for Unity

By : Charles Bernardoff
Book Image

NGUI for Unity

By: Charles Bernardoff

Overview of this book

Table of Contents (14 chapters)

Chapter 7. Creating a Game with NGUI

In this final chapter, we will create a game using NGUI elements, and this will ensure that you understand them and know how to use them perfectly.

Together, we will learn how to create these basic game rules, which are as follows:

  1. Enemies fall down from the top of our scrollable viewport.

  2. The player drops Barriers on the Viewport—if the enemy collides with a built Barrier, he or she is destroyed along with the Barrier.

  3. Some enemies have encrypted self-destruct code. The player clicks on the enemy to hack it. When the hacking process is complete, its destruct code is displayed above it.

  4. The player must type in the code to destroy the enemy.

We will also add a health bar that will represent the player's health points and will decrease when enemies hit the bottom of the screen. The game will look as follows: