AI for maze game


I’m building a 2D maze game in Flash featuring “smart” enemies but I’m having trouble writing the AI efficiently (i.e. with less code).

Presently, I’ve got a load of conditional if statements based on timer values. Everything works (just about) so far but I know it’s going to result in a complete mess if I carry on with this method. I’m sure theres a more efficient way to do this but I can’t work it out. Can anyone help?

I can e-mail the relevant file to anyone who is interested. Many thanks in advance.