itch.io is community of indie game creators and players

Devlogs

Self Study #4.1

utas kit207 portfolio
A downloadable project

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 :-)

Download utas kit207 portfolio
Leave a comment