C
Caedmon
Guest
I am currently making an action platformer and i have problems with collisions. The code goes like this:
Create
Speed = 0
Step
var move = (keyboard_check (vk_right)) - (keyboard_check (vk_left))
speed = move * walkspeed
If (place_meeting(x + speed, y, wall))
{
While (!place_meeting (x + sign(speed),y,wall))
{
x = x + sign (speed)
}
Speed = 0
}
What it is supposed to do is stop me from going through walls but it stops me from moving if i am on top of said object.
How can i fix this?
Create
Speed = 0
Step
var move = (keyboard_check (vk_right)) - (keyboard_check (vk_left))
speed = move * walkspeed
If (place_meeting(x + speed, y, wall))
{
While (!place_meeting (x + sign(speed),y,wall))
{
x = x + sign (speed)
}
Speed = 0
}
What it is supposed to do is stop me from going through walls but it stops me from moving if i am on top of said object.
How can i fix this?