This is what I have now.
PHP Code:
function checkPath(ox, dx, oy, dy) {
temp.dx = (dx + 1.25) - (ox + 1.25);
temp.dy = (dy + 1.25) - (oy + 1.25);
temp.delta = getDist((ox + 1.25), (oy + 1.25), (dx + 1.25), (dy + 1.25));
i = 0;
temp.onwall = false;
while (i < temp.delta) {
this.chat = temp.onwall;
//putnpc2((ox + 1.25) + ((temp.dx/temp.delta) * i), (oy + 1.25) + ((temp.dy/temp.delta) * i), "join(\"object_chair\");");
if (onwall2((ox + 1.25) + ((temp.dx/temp.delta) * i), (oy + 1.25) + ((temp.dy/temp.delta) * i),.5,.5)) {
temp.onwall = true;
this.chat = temp.onwall;
break;
}
i += .75;
}
return temp.onwall;
}
It's always returning true, and it isn't always working correctly.
All the + 1.25 and all that is so that it's centered from the center of the baddy to the center of the player, so that it's not going from the left corner of the baddy to the left corner of the player.