Module 4 Devlog: Simple Game


Devlog for Self Study 4: Simple Game

The scene created previously was used to create a simple game, where living barrels chase and murder a tourist.

The barrels are created using a spawner script provided by Ian Lewis, that creates copies of a prefab at regular intervals, the created barrels then chase the tourist player character, using navmesh for pathfinding.

Barrels being created and chasing tourist.

When the barrels collide with the player, some of the players health is removed and the barrels are destroyed. This is done using unity events.

Barrels Murdering tourist

Health packs were added to the scene to add health to the player when they collide with the health pack.

Tourist applying first aid to his grievous barrel wounds

The health pack was created using Blender, and a simple script was created to make the barrel rotate and bob up and down.

Swiss healthpack spinning and bobbing

Once the tourist's health falls to 0, their holiday is over, as they are dead. The camera switching was done by disabling the main camera and enabling a second camera, and the text was done by enabling a text object on a canvas when the players health drops to 0.


RIP tourist

Reflection

A problem I ran into was that when using the unity event system to trigger events like lowering player health, the barrel prefabs could not be linked to the player game object until after they were spawned in. To fix this I made a simple script with a function that finds the player character using their "Player" tag, and then lowers their health, and using the unity events to run that function when the barrels collide with the player. This was also used by the healthpacks.

Leave a comment

Log in with itch.io to leave a comment.