condensed some if statements in void keypressed

doesn’t change anything visibly