take a look at this AI exe file.
click ere
the devil basically walks around....
when it hits a solidob it is moved outside all solid objects...then the script walktoclear() is called.
firstly it stops the speed and rotates the devil...
it then works two col_lines 400 pixels in front of devil on each side this checks if it can fit through gaps .
this distance is halved when no clear position is found..
so when the 'path' ios clear it exits the do loop and the devil walks in new direction
at the mo for debugging it shows the rotation...you will see that sometimes it gets stuck in the do loop and just spins trying to find a clear path (where the coll_lines dont intersect any solidobs)
so need help with this.
in the do loop it checks if the direction-dir>360 if it is the distance to check for the coll_line is halved
dir=direction
do
{
direction+=5;
if direction-dir>360 {direction=dir;dist=dist/2}
col1=col_line(x+lenghtdirx(dist,direction+90) etc....
until (!col1 and !col)
cheerrs