Hello. I am just a beginner. I want to know how to complete a jump

Can I ask you one more question? Now I finish everything, and I want to calculate when I press the keycode, the number of jumping will add one. But I dont know how to add only one if I only press keycode one time.My code is:
void printScore() {
textSize(height/20);
fill(0);
String message = "Number of jumps: " + numJumps;
text(message, (width-textWidth(message))/2, textAscent()+10);
if (keyCode == UP||keyCode == DOWN||keyCode == RIGHT||keyCode == LEFT) {
numJumps++;
}
}

1 Like