Module 4 - Simple Game Mechanics


Module 4

This module was fairly short and was simply adding some game like elements into the scene. The first thing I did was get the spawner working as I've worked with spawning things like this before so it's fairly easy to do. I just placed a few spawners in the level and used the script provided. To give the enemies a target to chase I made each spawner know about the player was and each time an enemy is spawned it is told what their target is.

Spawner spawning things


The next part was to add some health into the game and make the enemies die when they get to the player. This was also fairly simple as I simply needed to check for collisions with an enemy and then delete them and decrease the health value.I then created a simple text display for the health. I was curious to see how Unity dealt with UI in 3D but it's basically the same as 2D just a bit more awkward to use.

Losing health


I created a simple health pack using 3D cubes and made it rotate on the spot. It is essentially the same as a enemy except that it adds health instead of taking it.

Health pack


The final part was a simple game over screen for when the player loses all their health. This was just a script that when the player loses health changes some text in the UI to the "YOU LOSE". It also looks a  bit weird because of the bootleg way I did a third person camera. A better way to do it is to use the Cinemachine plugins for unity but for the purposes of this exercise this version works fine.

Game over


Leave a comment

Log in with itch.io to leave a comment.