Week 5/Dev 4


With my spawning script, I created a ray upon a mouseclick (which gets the specific point in the world of the surface I clicked), but instead of displaying a message to show the coordinates of the ray, I used the coordinates gained by the ray to spawn an enemy prefab where I clicked. This was done by using the point info to instantiate the enemy. Regarding how I was able to get the enemy to seek out the player's location, I made a new script that takes the checks the player's location (transform) in every frame, before calculating where the player is, before finally pushing the enemy's velocity in that collection

As for the "proper" game, there were two major issues I ran into: the first is that whilst triggering the health increase and decrease worked well, and whilst enemies and healthboxes alike vanished when they came in contact with the player, for some strange reason, the player's health would carry over between tests and not reset. The second issue that I ran into was that the health display would not update live, and only update after resetting the test.  However, as you can see from the gif below, the player's health is increased and decreased in the debug menu upon executing the correct method.

This became especially frustrating when I needed to check whether or not the player would become inactive (disabled/"deleted") upon hitting 0 health, as unless I stopped the test at 0 health, then my player would be stuck at an absurdly negative health. 

Thankfully, this turned out not to be the case.


None of the other students seemed to run into this issue, so I wasn't entirely sure if this was due to something I had done by accident (which is the most likely answer) or if something weird just happened with my project. I tried searching up a solution online but the suggestions that were posted on similar forums didn't seem to help. 

Regardless, I was able to get the majority of the script to work, and even if the test didn't seem to update all too well, I'm still glad that the main feature - the incrementing and decrementing of health - worked perfectly.

Get Game Design Devlogs

Leave a comment

Log in with itch.io to leave a comment.