Self-study 4.1 (Simple Games)
This is the devlog for the first part of the self-study 4 of my portfolio.
I have to create a simple game that involves player getting chased by and enemies that spawns, losing health when hit by an enemy, regain health when picking up health packs and ending the game when player's health is dropped to 0.
I downloaded an asset that was provided and contained a script for spawning enemies, player's health, and a trigger detection (I already have this script). The first thing I did was modify the spawner script so enemies would get the player's position when they spawn. I created an object and put the script on the object and ensured it contain an enemy object and would chased the player when it spawned in.
Once I got that working, I moved on to decreasing the health of the player when the enemy hits it. I used the trigger detection script and used that script on the enemy object. I then linked the trigger detection script to the player health script so I could get the player health to decrease when the enemy hits the player.
For the health pack, I added the trigger detection script to it and made sure to check if player hits the health pack. I downloaded an asset of a health pack from unity's website. The script is linked to player's health script. Once it detected that player touch the health pack, it will regain the amount of health I specified in the script, in this case, 5. Here's the screenshot of the health pack I've downloaded:
Lastly, I displayed a game over text when player reaches 0 health. By adding in a text from unity and displaying it when the health is 0 or less.
Here's the gifs of showing all of these functionality:
References:
Health Pack - https://assetstore.unity.com/packages/3d/props/small-survival-pack-20565#content
UTAS KIT207 Portfolio
Status | In development |
Author | liamp4 |
More posts
- Tutorial 517 days ago
- Self-Study 518 days ago
- Self-Study 4.2 (Game Ideas)25 days ago
- Tutorial 328 days ago
- Self-study 332 days ago
- Tutorial 238 days ago
- Self-study 246 days ago
- Tutorial 146 days ago
- Self-study 152 days ago
Leave a comment
Log in with itch.io to leave a comment.