Thursday, 28 August 2014

Health and Score (week #7)

Learning how to add Health and a Score was definately a new experience for me as I did not really know that scripts could access variables from other scripts which blew my mind at first. The Health Bar tutorial by BurgZerg Arcade was extremely helpful with understanding how to create a basic healthbar using GUI.Box and how to make the healthbar accessible by other scripts by using public static variables. here is the link to the tutorial series if you want to check it out.
Adding score to the game was very similar to adding health. this was done by adding a score controller into the game and using public static variables that were accessed by the enemy script when it was destroyed by my grenade prefab. The value of the score was placed in a GUI.box with the text "Score: " attatched. A tutorial which helped me with understanding the score is UnityChat's Coin Collecting tutorial which uses coins instead of score but it is basically the same premise. here is the link to the tutorial

Next week I expect to have fully completed my first person shooter game by adding Raycast Shooting and further developing the score in my game by adding a Highscore.

No comments:

Post a Comment