Self Study 4


This week, we used our scene and some provided assets to create a basic game. 


Enemies spawning and chasing the player

Copies of an enemy prefab were spawned repeatedly using the Unity Coroutine function, which is an easy way of setting repeat tasks. To track the player, enemies would find the object with the 'Player' tag in the scene and target its positon. Then, they would track it with using the code from the previous self study.


Enemies giving damage and dying

A script on the player checks, upon collision with a trigger colider of tag 'Enemy', calls a function to deduct health points and destroys the game object of the collider. When the health is adjusted, the script changes the UI Canvas text to match.


Health orbs adding health

This interaction is very similar to the player-enemy interaction, except that health points are added.


The player dies and the game ends

When the player health reaches zero, it is deactivated. This triggers a function to activate a stationary camera overlooking the scene and some text over the screen.