for a little improved version of this path finding look here:

http://www.pascalgamedevelopment.com...?p=23808#23808