Zabicka
Member
I'm using this Collision code:
When my character is going diagonally and touching the wall
he moves slower than just touching the wall and moving horizontally, how can I fix this?
Code:
// Horizontal
if (place_meeting(x + hspd, y, obj_wall)) {
while (!place_meeting(x + sign(hspd), y, obj_wall)) {
x += sign(hspd);
}
hspd = 0;
}
x += hspd;
// Vertical
if (place_meeting(x, y + vspd, obj_wall)) {
while (!place_meeting(x, y + sign(vspd), obj_wall)) {
y += sign(vspd);
}
vspd = 0;
}
y += vspd;
he moves slower than just touching the wall and moving horizontally, how can I fix this?