O'Reilly logo

Unity 4 Game Development HOTSHOT by Jate Wittayabundit

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

Creating a hit-point UI

Now, we are at the last step of this project. We will add the hit-point game object for the player and enemy as well as create the HitPointUI script.

Engage thrusters

Let's get started:

  1. Go to the folder (for C# users, Chapter6 | Scenes | C# | UI, or for JavaScript users, Chapter6 | Scenes | JavaScript | UI) in the Project view, right-click and choose Create | C# Script (for C# users) or Create | Javasrcript (for JavaScript users), rename it to HitPoint.
  2. Double-click on the HitPoint script to open it in MonoDevelop. Start by creating all properties and the Update() function, as follows:
    // Unity JavaScript user: #pragma strict var ai : AI; var player : Player; var frameTexture : Texture2D; var hpTexture : Texture2D; var aiTexture ...

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