using my control movement script (movement functions, uploaded on graal.net), I came up with this specifically. Does it just about perfectly, except my movement scripts go exactly to the wall rather than rounding.
PHP Code:
function side_movement() {
this.w = 1;
this.h = 1;
for (i=0; i<4; i++) {
if (keydown(i)) {
temp.case_x = player.x+1 + vecx(i)*1.5*vecDir(this.speed_factor) - abs(vecy(i))*0.5;
temp.case_y = player.y+1.5 + vecy(i)*1.5*vecDir(this.speed_factor) - abs(vecx(i))*0.5;
temp.case_one = tilesSwitch(temp.case_x,temp.case_y,7/8,7/8);
temp.case_x = player.x+1 + vecx(i)*1.5*vecDir(this.speed_factor) + abs(vecy(i))*(5/8);
temp.case_y = player.y+1.5 + vecy(i)*1.5*vecDir(this.speed_factor) + abs(vecx(i))*(5/8);
temp.case_two = tilesSwitch(temp.case_x,temp.case_y,7/8,7/8);;
/* In case I screw this up
temp.case_x = player.x+1 + vecx(i)*1.5 - abs(vecy(i))*0.5;
temp.case_y = player.y+1.5 + vecy(i)*1.5 - abs(vecx(i))*0.5;
temp.case_one = tilesSwitch(temp.case_x,temp.case_y,7/8,7/8);
temp.case_x = player.x+1 + vecx(i)*1.5 + abs(vecy(i))*(5/8);
temp.case_y = player.y+1.5 + vecy(i)*1.5 + abs(vecx(i))*(5/8);
temp.case_two = tilesSwitch(temp.case_x,temp.case_y,7/8,7/8);;
*/
if (temp.case_one xor temp.case_two) {
if (temp.case_one) {
this.offx = 1.0 + vecx(i)*1.5*vecDir(this.speed_factor) + abs(vecy(i))*0.5;
this.offy = 1.5 + vecy(i)*1.5*vecDir(this.speed_factor) + abs(vecx(i))*0.5;
movedx(abs(vecy(i))*this.sidemove_speed,player);
movedy(abs(vecx(i))*this.sidemove_speed,player);
} else {
this.offx = 1.0 + vecx(i)*1.5*vecDir(this.speed_factor) - abs(vecy(i))*0.5;
this.offy = 1.5 + vecy(i)*1.5*vecDir(this.speed_factor) - abs(vecx(i))*0.5;
movedx(-abs(vecy(i))*this.sidemove_speed,player);
movedy(-abs(vecx(i))*this.sidemove_speed,player);
}
}
}
}
}
forgot to say, tilesSwitch would be the function you use for wall detection on an area.