I edited to this:
PHP Code:
function checkPath(ox, dx, oy, dy) {
temp.delta = {dx - ox, dy - oy, (temp.delta[0]^2+temp.delta[1]^2)^.5}; // get the delta's and distance
i = 0;
temp.onwall = false;
while (i < temp.delta[0]) { // while i is less than the distance between player and NPC
temp.onwall = onwall2(ox+(temp.delta[0]/temp.delta[2])*i,oy+(temp.delta[1]/temp.delta[2])*i, 1, 1);
if (temp.onwall) break;
i++;
}
return temp.onwall;
}
And it's still not working. =o