Self Study #4.1


In this self study we had to make a simple game where there are enemies that spawn and chase the player, reducing the player’s health on collision. I had to tweak some of my chase script, namely adding a line to find the object with the “Player” tag on startup.

targetParent = GameObject.FindGameObjectWithTag("Player");
target = targetParent.GetComponent<CharacterController>();

After doing that the script worked fine with the spawner, other than the fact that after the initial gameObject the script was referencing was despawned (de-activated using the trigger script) it would stop spawning enemies (because the original no longer was active, it would spawn non-active enemies). This was fixed with the tried and true workaround of “the referenced gameObject being unreachable”. I did try exporting the gameObject into a prefab and have the spawner reference that, however that did not work because it needed some non-runtime bits and bobs from the player with the health script applied for the trigger script to interact with the player.

Other than that, smooth sailing through this one :-)

Gif of player getting a health pack

Gif of player losing health and dying and game over screen

Get utas kit207 portfolio

Leave a comment

Log in with itch.io to leave a comment.