Hi!
I've been working on programming some enemies, but have run into a couple of problems along the way.
First of all, I want my enemies to move like they're on a grid, 16x16. I have MOSTLY accomplished this. The enemy sprite moves right, left, up, or down like it should, until it just suddenly... Stops. I'm not sure why. I have it set up on a timer. Every time the timer finishes, the code randomly selects an action, moving one of the four directions, using the MoveTo function. going 16 pixels at a time. It is random when the enemy stops moving as well. Sometimes it lasts for thirty seconds, other times it gets stuck right from the get go. Can anyone help with this problem?
Also, a question about further coding. I'm hoping to be able to make my enemy lunge at my player, but only when it is in a certain proximity. I figured that the area can just be a filled region, but how can I make the enemy still always pick the direction that is closest to the player, but still stay on that four directional grid?
Thank you so much in advance!