Moving one tile at a time is fine for a random or player following AI, but I need my AI to follow a set path that it had thought of earlier, and that path needs to change based on things that will be explained below.
Here's a breakdown of how my AI is supposed to work:
AI decides upon destination.
AI runs a function that changes the values of an array based on what directions it is able to move in. (EX - if the AI is able to move up and down, the the array would equal 1,1,l,r, and if it could move left and down and right then it would equal u,1,1,1)
AI checks what it's ideal movement is (AKA what movement would get it to it's destination the fastest)
SMART AI STUFF HERE
EX.
11111111111111
10000000000001
10111111100001
12000000130001
10111111100001
10000000000001
11111111111111 Â Â Â Â Â Â Â Â Â
1 - wall
2 - the AI
3 - the player
If the AI's destination is the player, and it just checks if it can move in the direction of it's destination and then moves there, the AI will walk into the dead end and look stupid. The SMART AI STUFF HERE would fix this problem, and it is that that I am having trouble coding.