I had typed up all my notes, but the 'Authorization Error' I seem to get every now and then on this forum happened, and I'd rather not type it all up again (why isn't this fixed?).
Here is a brief version of my notes on this.
Two States:
-Move (starting state)
-Fire
Fire:
-If in Fire, set variable PredictedFiringAngle = angle(Self.X, Self.Y, Player.X, Player.Y) + asin((Player.Speed * sin(angle(Self.X, Self.Y, Player.X, Player.Y) + 180 - Player.MovingAngle))/ SelfBullet.Speed)
-Update this variable before every fired shot
-If Player is within 50 pixels of self, do not end this state, instead just keep firing at the object's fire rate
-If Player's angle = angle(Self.X, Self.Y, Player.X, Player.Y) + or - 10 degrees for 1 second or more then Player is facing the AI and the AI should turn and fire back.
-If Player is beyond 50 pixels of self, set state to Move after several shots
Move:
-If Player's angle = angle(Self.X, Self.Y, Player.X, Player.Y) + or - 10 degrees for 1 second or more then Player is facing the AI and most likely firing, so enter Fire state.
-If Player is within 50 pixels of the AI, immediately enter Fire state and fire upon the player.
-AI should try to move behind the player and avoid flying into the path of the player (avoid dumb AI)
-???
Any thoughts on this?