hijong park
Member
When i use vspeed, hspeed, friction to make the player move, I want to make the players to precisely colide with walls and stop.
Both player and walls have square hitboxes.
I made the players to move by using motion_add(), and add friction with friction = player.speed / 10.
and for the block collision I used this method at step event :
Code:
if !place_free(x+hspeed,y)
{move_contact_solid(direction,speed); hspeed = 0;}
if !place_free(x,y+vspeed)
{move_contact_solid(direction,speed); vspeed = 0;}
Sometimes when I move and hit the wall diagonally, The player gets stuck in the wall. also, This method only works with solid objects. If possible, I want to make it to work with non solid objects for better performance.