static public void set(String name) {
        if (states.containsKey(name)) {
            //set prevState
            if (currentState!=null && currentStateName!=null) {
                prevState=currentState;
                prevStateName=currentStateName;

                //if this state has a main component
                if (prevState instanceof GameStateC) {
                    ((GameStateComponent) prevState).destroy();
                }
            }

            //set currentState
            currentState=states.get(name);
            currentStateName=name;

            currentState.action();
            Game.container.repaint();
        }
    }