Example #1
0
        public override void Stop()
        {
            base.Stop();
            //Background GameObjects
            background = null;
            levelBar = null;
            tracks = null;
            trackStops = null;

            //Menu GameObjects
            sideBar = null;
            miner = null;
            buttonMenu = null;
            buttonScore = null;
            buttonBonus = null;
            buttonWord = null;
            bonusEnglish = null;
            //Play Area GameObjects
            mineCarts = null;
            mineCartsTNT = null;
            explosions = null;
            lastMineCarts = null;
            popupScoreScene = null;
            popupMenuScene = null;
            popupLoseScene = null;
            popupBonusScene = null;
            popupQuizScene = null;
        }
Example #2
0
        public override void Start()
        {
            base.Start();

            level = 1;
            startGame = true;
            startCurrentX = 0;
            startCurrentY = 0;
            score = 000;
            levelScore = 000;
            levelMaxScore = 1000;
            builtString = "";
            this.language = "english";
            lose = false;
            bonusEnglish=new List<bonusword>();
            isBonus = false;
            tntChance = 0.2f;
            numberOfTNT = 0;
            maxNumberOfTNT = 0;

            animating = false;
            usedTNT = false;

            this.dictionary = null;
            this.alphabet = null;
            this.bonus = null;
            this.bonusSeed = null;
            this.bonusWordLength = 3;

            //Game Data Initialization
            rand = new Random();
            alphabet = new Dictionary<String, Double>();
            dictionary = new List<String>();
            bonus = new List<String>();
            bonusSeed = new List<char>();
            startGame = true;
            highestPointWord="";
            highestPointWordScore=0;
            longestWord="";

            popupScoreScene = new PopupScoreScene();
            popupMenuScene = new PopupMenuScene();
            popupLoseScene = new PopupLoseScene();
            popupBonusScene = new PopupBonusScene();
            popupQuizScene = new PopupQuizScene();

            wordsMade = new Dictionary<String, int>();
            //Background Initialization
            background = new GameObject("background/playScene2", new Vector2(BACKGROUND_OFFSET_X, BACKGROUND_OFFSET_Y));
            background.zindex = 0.1f;
            gameObjects.Add(background);
            cartBonus = 1;
            tracks = new List<GameObject>();
            trackStops = new List<GameObject>();
            GameObject temp;
            for (int i = 0; i < CART_COLUMNS; i++)
            {
                temp = new GameObject("background/tracks/track" + (i + 1).ToString(), new Vector2(TRACK_OFFSET_X + (i * TRACK_SPACING_X), TRACK_OFFSET_Y));
                temp.zindex = 0.2f;
                tracks.Add(temp);
                gameObjects.Add(temp);

                if ((i % 2) == 0)
                {
                    temp = new GameObject("foreground/trackStop", new Vector2(TRACK_STOP_OFFSET_X + (i * TRACK_STOP_SPACING_X), TRACK_STOP_OFFSET_Y));
                    temp.zindex = 0.21f;
                    trackStops.Add(temp);
                    gameObjects.Add(temp);
                }
            }
            leveledUp = false;
            levelBar = new LevelBar("menu/levelBarBackground", new Vector2(LEVEL_BAR_OFFSET_X, LEVEL_BAR_OFFSET_Y), "menu/levelBarTop", "menu/levelBarFill");
            levelBar.noAnimate = true;
            levelBar.zindex = 0.2f;
            gameObjects.Add(levelBar);

            //Menu Initialization

            sideBar = new GameObject("menu/sidebar", new Vector2(SIDEBAR_OFFSET_X, SIDEBAR_OFFSET_Y));
            sideBar.zindex = 0.2f;
            gameObjects.Add(sideBar);

            miner = new GameObject("menu/miner", new Vector2(MINER_OFFSET_X, MINER_OFFSET_Y));
            miner.zindex = 0.3f;
            gameObjects.Add(miner);

            buttonBonus = new TokenGameObject("menu/buttonJumble", new Vector2(BUTTON_BONUS_OFFSET_X, BUTTON_BONUS_OFFSET_Y), "");
            buttonScore = new TokenGameObject("menu/buttonScore", new Vector2(BUTTON_SCORE_OFFSET_X, BUTTON_SCORE_OFFSET_Y), "0");
            buttonWord = new TokenGameObject("menu/buttonWord", new Vector2(BUTTON_WORD_OFFSET_X, BUTTON_WORD_OFFSET_Y), "");
            buttonMenu = new TokenGameObject("menu/buttonMenu", new Vector2(BUTTON_MENU_OFFSET_X, BUTTON_MENU_OFFSET_Y), "Menu");

            buttonBonus.zindex = 0.3f;
            buttonScore.zindex = 0.3f;
            buttonWord.zindex = 0.3f;
            buttonMenu.zindex = 0.3f;

            buttonScore.fontColor = Color.Gold;

            buttonBonus.fontRotation = -0.1f;
            buttonWord.fontRotation = 0.1f;

            buttonBonus.noAnimate = true;
            buttonScore.noAnimate = true;
            buttonWord.noAnimate = true;
            buttonMenu.noAnimate = true;

            buttonBonus.fontPath = "fonts/WesternSmall";
            buttonScore.fontPath = "fonts/WesternSmall";
            buttonWord.fontPath = "fonts/WesternSmall";
            buttonMenu.fontPath = "fonts/WesternSmall";

            gameObjects.Add(buttonBonus);
            gameObjects.Add(buttonScore);
            gameObjects.Add(buttonWord);
            gameObjects.Add(buttonMenu);

            //Play Area Initialization

            mineCarts = new MineCart[CART_COLUMNS, CART_MAX_ROWS];

            lastMineCarts = new List<MineCart>();

            mineCartsTNT = new List<MineCart>();

            AnimatedInteractableGameObject explosion;

            explosions = new List<AnimatedInteractableGameObject>();
            for (int i = 0; i < 5; i++)
            {
                explosion = new AnimatedInteractableGameObject("foreground/explosion", new Vector2(0, 0), 25, 5, 10);
                explosion.zindex = 0.4f;
                explosion.finished = true;
                gameObjects.Add(explosion);
                explosions.Add(explosion);
            }
        }