BURNING MEMORIES (TEAM PROJECT) | DEVELOPMENT LOG 4
Health
At first, our main idea was to add a lock and key system where the player would have to go in and out of rooms searching for keys that unlocked the next room. However, since I didn’t have much time to script all the doors in, I consulted the rest of my team and asked if health decrease over time would be more ideal for our game concept. With everyone agreeing to it, I started to script the new idea where the player would have to find the way through the main level and gaining health by going into rooms to find health. The health more represents how the player doesn’t want to visit their old house that previously set on fire, and the ‘health pickups’ and happy memories that give the players health, similar to a sanity meter.
To script this, I set up a Coroutine that started when the game is launched. I had difficulty at first as the while loop failed to work and would only take off 1 health when the game was started, not every second. The reason for this was the parameters for the while loop was set so it asked if the health was less than the max health it would restart the loop, therefore I just changed it so it will rerun if 0 is less than 1 which is always true. To keep the current health from scene to scene, I had to set a static integer which isn’t changeable from any other code. For now, I’ve set the max health for 30 (seconds) but can be increased if the game is too hard. Also, when the player reaches 0 health, they will then be set back up to max health (30) and be sent to scene 0 (menu).
To pick up the health, I used Gizmo’s as I did with the door script so when the player is within a certain radius of the picture and pressed F, it gives the player an extra 15 health. As shown in the animated gif, the picture stays thereafter picking it up, therefore I changed it to destroy it when the player pressed F.
The health bar is a placeholder for now, and will be replaced if a suitable replacement is made by another member.
Seek PNG (N/A) Health Bar [Image] Available online: https://www.seekpng.com/ipng/u2q8y3i1t4w7r5r5_health-bar-health/ [accessed 07/04/2021]