public void setState(String name) {
        // clean up old state
        if (currentState != null) {
            currentState.stop();
        }
        inputManager.clearAllMaps();

        if (name == EXIT_GAME) {
            done = true;
        }
        else {
            // set new state
            currentState = (GameState)gameStates.get(name);
            if (currentState != null) {
                currentState.start(inputManager);
            }
        }
    }