merged player's keydown and keyup code