Self Study 4: A Simple Game


The first part of this week's self study was to consolidate the work we've done over the last few weeks to produce a simple game. To start off, I used the provided enemy spawn script to create spawning points that spit out enemies every couple of seconds. They then chase the player, which I implemented in the tutorial last week. 


Enemies are regularly spawned and chase the player.



I also used the provided player health script and added code that reduces the player's health when they collide with the enemies and disables the enemy game object (i.e. 'killing' it). I created a UI canvas and added text to link up with the health script and display the player's current health.  

On enemy collision player health reduces and the enemy dies. 


Next up was adding health packs. I created it using the unity primitive objects (capsule for the white pill and scaled two cubes for the cross). I also made it so when the player collides with its trigger they are given health and the pack is destroyed.  To give the health packs some visual interest I added a simple script that rotates it every frame. 

Spinning health pack.


Player gets health and the pack is destroyed. 


Finally I added a game over state by disabling the player when their health reaches 0 (or below). I also made it so the health text is replaced by a death message and created an explosion prefab that is instantiated at the player's death location.  I created the explosion using the Unity particle system. Given more time I would create a more interesting effect, as I only changed the duration, emission rate, and colour.

Player dies, UI changes, and explosion appears.   



It was cool to get a simple game running that combines all the stuff I've created over the last few weeks.

Get UTAS KIT207 Portfolio

Leave a comment

Log in with itch.io to leave a comment.