Implements the handleInput state machine in Player class