GML
//Horizontal collision checking
if (place_meeting(x + hor_speed,y,WALLS))
{
while(! place_meeting(x+sign(hor_speed),y,WALLS))
{
x += sign(hor_speed);
}
hor_speed = 0
}
//Vertical collision checking
if (place_meeting(x,y+vert_speed,WALLS))
{
while(!place_meeting(x,y+sign(vert_speed),WALLS))
{
y += sign(vert_speed);
}
vert_speed = 0;
}
//Move!!!
x += hor_speed;
y += vert_speed;