Developing the Health System
During this month I started a tutorial to learn how to build a RPG game. The reason i have decided this path is to grasps the basics and better a fundamental structured core game mechanics before tackling the creative part. One of the first things I did is adding a health bar system to the game. In this particular RPG a health system is important as the objective would be about avoiding the enemy as well as dealing damage to the enemy.
To do this I first create two scripts for the player and enemy. Below is example of the what the script looks like.
Figure 1: Player and Enemy Script
Inside the scripts i then created the Max health and Current health public integers variables to store the players and enemies health. As well as creating a box to show the bars i also created an If Statement condition that allows the hp bar to deplete based on the collision between the player and the enemy. Below is the end result of the health bars.
Figure 2: Health bars
RPG Hack Slash Game: Targeting
Today i created a targeting system for the player. This is done by a creating a target script where it mark the colour of the target that the player is selecting and change colour when the player selects the target. Also once the target is selected, the player can then attack the enemy(which are the cubes in this case) pressing the attack key and enemies health will deplete. This is a very useful feature and will come useful later on when the enemies models are introduced. Below are the examples of the cubes and the target script
Figure 1: Player Selecting which enemy to attack
Figure 2: Target Script