Controlling the game with a State Machine