Posted August 09, 2021 by AdamRutledge
I tried to make the enemies follow the player with no success. I ended up using some code I wrote in Games Fundamentals to get the enemies to follow the player. This code was written for a 2D game so I just removed all the references to 2D and then it worked. I adjusted some scripts so that the players health would go down when the enemy hit them and up when the player hit the health pack. However, when I ran the game the health didn't appear to go down. After, a lot of trial and error, I worked out the problem. It turned out I had set the health to something else but had not updated the UI that tells you the players health. I made sure the player was destroyed when their health hit 0.
The player is the white capsule, the enemies are the black cubes and the health pack is the pink cylinder.