• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Player object stops falling if i hold left or right next to a collision object.

Like i said above. i tried to look up solutions, or different tutorials on how to do movespeed. I've been scratching my skull all day, and thought i'd ask here, since i've gotten alot of help here before.
i apologize if I'm unclear of what's the issue.
here is the code:



GML:
#region //Get player input
if (hascontrol)
{
key_left = keyboard_check(vk_left) or keyboard_check(ord("A"));
key_right = keyboard_check(vk_right) or keyboard_check(ord("D"));
key_jump = keyboard_check(vk_up) or keyboard_check(ord("W")) or keyboard_check(vk_space);
}
else
{
    key_right = 0;
    key_left = 0;
    key_jump = 0;

}
//Calculate Movement
var move = (key_right - key_left) * walksp;
hsp = approach(hsp, move, accel);
vsp += grv;

//jumping
canjump -= 1;
if (canjump > 0) and (key_jump)
{
    vsp = -7;
    canjump = 0;
}
#endregion

#region //Horizontal Collison and vertical
//horizontal collision
if (place_meeting(x+move,y,pCollision))
{
    while (!place_meeting(x+sign(move),y,pCollision))
    {
        x += sign(move);
    }
    move = 0;
}
x += hsp;



//Vertical Collison
if (place_meeting(x,y+vsp,pCollision))
{
    while (!place_meeting(x,y+sign(vsp),pCollision))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}
y += vsp;

#endregion
 
Top