Week 2 | Dev Log | Jamie Pasnin


Week 2 | Development Log | FPS RPG

Creating Health System

Introduction

This week I was tasked to create a health system script with public functions that can be utilized by other team developers. Additionally, tasked myself to create a health bar User Interface artwork and Prefab.

Goals

The following are the primary goals for this week.

  1. Research methods as to how to implement a health system within Unity.
  2. Create health system script with:
    1. Variables such as health and max health.
    2. Public Functions that other team developers can use to communicate with the script to implement health on characters.
  3. Create health User Interface artwork.
  4. Implement health User Interface artwork within Unity and save it as a Prefab for use for other team developers.

Personnel

The following is the primary author and any secondary authors who assisted in completing the set tasks given this week. 

  • Primary - Jamie Pasnin
  • Secondary - N/A

Technologies, Tools, and Resources Used

The following are the technologies, tools and resources used to assist in completing the set goals this week.

Key Tasks Undertaken

The following are the key tasks that were taken to help a developer/reader understand how the tasks were completed.

  • Began by researching methods as to how to implement a health system script and UI within Unity:
    • Found three YouTube videos that discuss similar methods. Links shown above.
    • Chose (How to make a HEALTH BAR in Unity!) method because the video covers a broader range of how to implement a health system. Includes not only how to create player health UI but also UI that follows the player/enemy within the world.
  • Created a health system script by:
    • Creating a script called 'HealthController'. Added 'using UnityEngine.UI' so the script can utilize Unity UI functionalities. Then created the following variables shown in the screenshot below that use [SerializeField] so that the variables can be private but also editable within the editor. Added a tool-tip for each variable with a small (green) comment.
  • Health Script: Variables
    • Then created three public health functions that set to the health UI which are 'SetHealth' and 'SetMaxHealth' that a developer can use. Used the fillAmount function for updating health UI as that was the best method for the design of the health bar. Used Unity Documentation and help from senior programmer to know how to utilize fillAmount function. Also added a  'Death' function if the characters health ever reaches zero. It currently has no functionality at the moment. 
  • Health Script: Functions
    • Created Health UI artwork:
      • Used Adobe Illustrator to create the health bar border, fill and health icon shown below.
  • Health UI Artwork
    • Then implemented the health UI into Unity:
      • By first importing the health art sprites.
      • Added canvas into Unity Editor, with an empty object being the capsule for health images. Added three 'Images' into the scene for fill, border and icon. Then positioned them to how I wanted it.
      • Then added the 'HealthController' script onto the 'HealthBar' capsule and created a 'HealthBar' prefab. Screenshot of how it looks at its final below.
  • Unity Editor Look At Health UI
  • After completion, I then pushed my work onto Jamie_Pasnin branch on SourceTree.

What I Found Out

The following is any particular lessons learned this week.

  1. Learned a new method for implementing a health system as a separate module within Unity.
  2. Learned how fillAmount function works within Unity.
  3. Learned how to improve my organisation and formatting of my code with adding [SerializeField] and tool-tip for each variable.

Open Issues/Risks

The following is a list of any issues or risks that were unable to be resolved that caused tasks to not be completed this week. 

  • No issues or risks were presented that caused tasks to not be completed. 

Solution Justification

The following describes why I chose the solution that I did to complete the goals set this week. 

When I began my research for the purpose of finding effective methods for creating a health system, I found three tutorials with similar methods but slightly different execution. I chose the third YouTube video by Brackeys because his tutorial covers the broad range/ big picture of how to create a health system and as mentioned covers how to implement health UI to characters within the world. 

For the health User Interface I chose to copy the Borderlands 3 design of the health bar and icon because the game is at prototype phase and this design will be used as a base sample that can be polished and improved upon in the future.

Leave a comment

Log in with itch.io to leave a comment.