# I can't jump when i press up, and left at the same time

///Get player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = keyboard_check(ord("D"));

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x, y+1, Obj_Floor))
{
vsp = key_jump * -jumpspeed;
}

if (vsp < 0) && (!key_jump_held) vsp = max(vsp,0)

//Horizontal Collision
if (place_meeting(x+hsp, y, Obj_Floor))
{
while(!place_meeting(x+sign(hsp), y, Obj_Floor))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;

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

//Animate
if (move != 0)
{
image_xscale = move;
}

if (place_meeting(x, y+1, Obj_Floor))
{

if (move != 0)
{
sprite_index = CalvinWalking;
image_speed = 0.07;
}

else
{
sprite_index = CalvinStanding;
image_speed = 0.025;
}
}

else
{
if (vsp < 0) sprite_index = CalvinJumping
else sprite_index = CalvinJumping
}


and

///Shooting with D
//Shooting direction
if (keyboard_check(vk_right))
{
mpfacing = 0;
}

if (keyboard_check(vk_left))
{
mpfacing = 180;
}

if (keyboard_check(vk_up))
{
mpfacing = 90;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
instance_create(x+13, y-0.5, Obj_MP_Laser);
canshoot = false;
alarm[1] = 30;
}


is my code but for some reason when i press up, and move left, i can't jump when i press space. Which i don't understand because i can jump when moving left, and when i press up, but not when i press both.

• Standard sanity test: does it work if you replace space with, say, Z? Many keyboards have trouble registering multiple keys with the spacebar. – Quentin Apr 16 '18 at 11:59
• When i changed space to S it works, but i wanted it to be space though. – Gameboy The Collector Apr 17 '18 at 11:47
• Then unfortunately it's a hardware problem. You'll need a keyboard with N-key rollover (NKRO) to avoid these limitations. – Quentin Apr 17 '18 at 11:50
• I'll just change the controls for jump and shoot to z and x and hope it's ok. However, thank you so much, at least the problem is now fixed now – Gameboy The Collector Apr 17 '18 at 12:05