View Single Post
  #43  
Old 12-25-2007, 01:11 AM
Rapidwolve24 Rapidwolve24 is offline
North*
Join Date: Oct 2007
Location: Massachusetts
Posts: 178
Rapidwolve24 is on a distinguished road
Send a message via AIM to Rapidwolve24 Send a message via MSN to Rapidwolve24
I know I'm a little late but wouldnt something like this do the trick

PHP Code:
public function CheckPath(x, y, dx, dy)
{   
   
temp.check = 0;
   
temp.checkrate = 1;
   
   
temp.distance = distance(x, y, dx, dy);
   
temp.angle = getangle(dx - x, dy - y);
   
   while (
temp.check < temp.distance)
   {
     
temp.checkx = int(x + (temp.check * cos(temp.angle)));
     
temp.checky = int(y + (temp.check * -sin(temp.angle)));
     
     if (
onwall(temp.checkx, temp.checky))
     {
        
temp.onwallcounter += 1;
     }
   
     
temp.check += temp.checkrate;
     
     
sleep(0.05);
   } 
  return 
temp.onwallcounter;
} 
Reply With Quote