7
7bones
Guest
Hi.I have poblem with top down collision
Here is code in collision event
a = point_direction(x, y, other.x, other.y); //Get the direction from the colliding object
xoff = lengthdir_x(1, a); //Get the offset vector
yoff = lengthdir_y(1, a);
//Move out of collision
while (place_meeting(x, y, other))
{
x -=xoff //Move the instance out of collision
y -=yoff
x = round(x)
y = round(y)
}
Problem is big sliding.When player walk in something (like door,wall etc) slides in side to go out of collision- that looks very bad.
I also have collision system with some objects to Player cant move when walk into objects- but i also need that code to make all looks natural.
Here is question- what change in this code to make player stand exactly in same position while colliding- not slide anywhere??
Here is code in collision event
a = point_direction(x, y, other.x, other.y); //Get the direction from the colliding object
xoff = lengthdir_x(1, a); //Get the offset vector
yoff = lengthdir_y(1, a);
//Move out of collision
while (place_meeting(x, y, other))
{
x -=xoff //Move the instance out of collision
y -=yoff
x = round(x)
y = round(y)
}
Problem is big sliding.When player walk in something (like door,wall etc) slides in side to go out of collision- that looks very bad.
I also have collision system with some objects to Player cant move when walk into objects- but i also need that code to make all looks natural.
Here is question- what change in this code to make player stand exactly in same position while colliding- not slide anywhere??