I've been trying to make my enemy NPCs patrol some sort of path and then attack the enemy if the player is in the LOS (line of sight).
To do this, I'm using an invisible box sprite pinned to each badguy so when you are in the box, the enemy starts chasing you. Once you're out of the box, the enemy goes back his scripted patrol in whatever location he stopped at.
The script I have is working, but only the patrol is working for 1 enemy. I'm wondering if anyone else has an easier way to do something like this?
My main event looks like this :
For each BadGuy
If box is overlapping player, attack
If box is NOT overlapping player, Bullet right, stop, bullet left, stop etc.
Any help or advice would be much appreciated.