Exemplo n.º 1
0
 public void setNextGame(int type, int levelNum = 0)
 {
     modifiedLevel    = false;
     currentLevel     = levelNum;
     currentLevelType = type;
     if (type == Room.ADVENTURE)
     {
         currentLevelObj = null;
         if (UserData.settings.adventureData != null)
         {
             currentLevelObj = UserData.settings.adventureData;
         }
     }
     else if (type == Room.PUZZLE)
     {
         if (UserData.settings.puzzleData != null && !editing)
         {
             currentLevelObj = UserData.settings.puzzleData;
             currentLevel    = UserData.settings.puzzleLevel;
         }
         else
         {
             currentLevelObj = Library.levels[levelNum];
         }
     }
 }
Exemplo n.º 2
0
 public void puzzleWin()
 {
     if (!editing || !modifiedLevel)
     {
         currentLevel++;
         currentLevelObj = currentLevel < Library.TOTAL_LEVELS ? Library.levels[currentLevel] : null;
     }
     if (currentLevelObj != null)
     {
         String str = (currentLevel < 10 ? "0" : "") + currentLevel;
         transition.begin(nextLevel, DEATH_FADE_COUNT, DEATH_FADE_COUNT, str, 15, null, 20);
     }
     else
     {
         transition.begin(quit, DEATH_FADE_COUNT, DEATH_FADE_COUNT, "\"poo-tee-weet!\"", 90, null, 30);
     }
 }
Exemplo n.º 3
0
 public void resetGame()
 {
     if (!editing)
     {
         if (level.data.room.type == Room.ADVENTURE)
         {
             UserData.settings.adventureData = null;
             currentLevelObj = null;
         }
         else if (level.data.room.type == Room.PUZZLE)
         {
             UserData.settings.puzzleData = null;
             currentLevelObj = Library.levels[currentLevel];;
         }
         UserData.push(true);
     }
     initLevel();
 }
Exemplo n.º 4
0
    /*  */
    private void init()
    {
        // GAME GFX AND UI INIT
        if (state == GAME || state == MENU)
        {
            renderer.createRenderLayers(this);
        }

        addChild(transition);

        if (focusPrompt == null)
        {
            focusPrompt = new Sprite();
            focusPrompt.addChild(screenText("click"));
            //stage.addEventListener(Event.DEACTIVATE, onFocusLost);
            //stage.addEventListener(Event.ACTIVATE, onFocus);
        }

        if (state == GAME || state == MENU)
        {
            frameCount       = 1;
            currentLevel     = 0;
            currentLevelType = TEST_BED_INIT ? Room.ADVENTURE : Room.PUZZLE;
            currentLevelObj  = null;
            titleMenu        = new TitleMenu();
            if (state == GAME)
            {
                initLevel();
            }
        }

        addListeners();

        // this is a hack to force clicking on the game when the browser first pulls in the swf
        if (forceFocus)
        {
            onFocusLost();
            forceFocus = false;
        }
        else
        {
        }
    }