O fuj! Nie wiem po co ci lengthdir'y. Zaraz Ci podeślę sposób jaki użyłem w I accidently made polybius. Wrócę z editem.
GML
stat_speed=10//Prędkość poruszania
if!((keyboard_check(vkey_up) or keyboard_check(vkey_down)) and (keyboard_check(vkey_left) or keyboard_check(vkey_right)))
{ss=stat_speed}
else
{ss=(stat_speed/2)*sqrt(2)}
if(keyboard_check(vkey_up)){if(place_free(x,y-32)){y-=ss*dt()}else{move_contact_solid(90,ss*dt())}}
if(keyboard_check(vkey_down)){if(place_free(x,y+32)){y+=ss*dt()}else{move_contact_solid(270,ss*dt())}}
if(keyboard_check(vkey_left)){if(place_free(x-32,y)){x-=ss*dt()}else{move_contact_solid(180,ss*dt())}}
if(keyboard_check(vkey_right)){if(place_free(x+32,y)){x+=ss*dt()}else{move_contact_solid(0,ss*dt())}}
Usuń sobie delta_time (dt()) jeśli nie potrzebujesz.