Self Study 4a - Simple Game


In rather quick sequence, you can see enemies spawning and following the player, the player picking up a health pack to increase their health, the enemies colliding with the player and dying while reducing the players health, and then the player dying upon reaching zero health. And a lot of explosions.

Spawning / Following functionality

The point that spawns the enemies contains a reference of the player and the prefab from which to create the enemies. Upon creating an enemy, it sets the enemies controller script target to that player reference. The following functionality is no different to previous devlogs, simply using the in-build Unity NavAgent functionality to plot out the path to the player.

Enemy Death / Damage

Upon colliding with the player, they decrease the players health by one, spawn an explosion particle effect at their position, when delete themselves from the game world.

Health packs

Made with probuilder to mock up the model, upon colliding with anything with the "player" tag it attempts to increase their health by one.

Game Ending / Player Death

Upon the player reaching zero health a number of events fire in sequence for the final effect. First the cameras (first and third-person) are detached from the player character onto a separate object so they aren't deleted when the player is destroyed. This new object has a rotation script added to it for the dramatic camera pan around the players point of death. A UI element containing the "YOU DIED" text also has its colours alpha channel increased towards 1 over a short period, fading in the text.

After a delay of one second, a very large explosion effect is spawned at the players position and the player is deleted from the scene.

The explosion effects were tweaked from those found in the Unity Particle Pack but tweaked to work with the Universal Render Pipeline that this project is running with.

Leave a comment

Log in with itch.io to leave a comment.