Modify state machine in CharacterMovement.js