Skip to main content
r/processing icon

r/processing

members
online

When I press the sprint key the other keys don't work. When I press the sprint key the other keys don't work.

When I hold down the sprint it works fine as long as don't press a new key then that key won't work. Some of the code:

void keyPressed() {

if (key == 'd') rightPressed = true;

if (key == 'a') leftPressed = true;

if (key == 'w') upPressed = true;

if (key == 's') downPressed = true;

if (keyCode == SHIFT) humanSpeed = humanRuningSpeed;

if (key == 't')

{

if(debug)

{

debug = false;

}else

{

debug = true;

}

}

}

void keyReleased() {

if (key == 'd') rightPressed = false;

if (key == 'a') leftPressed = false;

if (key == 'w') upPressed = false;

if (key == 's') downPressed = false;

if (keyCode == SHIFT) humanSpeed = humanWalkingSpeed;

}

void updateInput() {

horizontalInput = 0;

if (rightPressed) horizontalInput += 1;

if (leftPressed) horizontalInput -= 1;

verticalInput = 0;

if (downPressed) verticalInput += 1;

if (upPressed) verticalInput -= 1;

}


The everything app, for work. Get everyone working in a single platform designed to manage any type of work.

Trusted by 3 million+ teams, try ClickUp for free today!

Image The everything app, for work. Get everyone working in a single platform designed to manage any type of work.