This was one of my first projects when starting. I had enemy ai that would detect the player within a cone, while the player is picking up collectables.
This code I'm setting time until spawn with a random range between my minimum spawn time & maximum spawn time, then in update I'm taking away time until spawn and if my time until spawn is equal to or less than 0 I spawn my enemy.
This code is for my enemy and is checking if distance between my player and enemy are less than what my range is than they'll chase the enemy.
This code I'm getting the input for my flashlight button and if my lights true/on than drain the life time if on. I also made it so my light doesn't go under 0 or over 100, I also added reload button that turns on my light.
SPRINTS