Beispiel #1
0
        public void NextLevel()
        {
            //transition to next level
            win = false;
            paused = false;
            currentLevel++;

            if (currentLevel >= levels.Count) //if no more levels
            {
                map = new Map(player); //make blank map, change background to win screen and remove player from game area
                background.Image = ImageBank.win_background;
                player.Location = new Rectangle(999, 999, 1, 1);
            }
            else//otherwise, load next level
            {
                map = new Map(player);
                map.Load(levels[currentLevel]);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            //spawn a player and a wall here for testing purposes
            pausemessagething = new GameObject();
            pausemessagething.Location = new Rectangle(170, 100, 500, 200);
            pausemessagething.Image = ImageBank.pausemessage;

            player = new Player();

            textBox = new InputWindow(player);

            //set up winscreen
            winscreenpopup = new GameObject();
            winscreenpopup.Location = new Rectangle(170,100,500,400);
            winscreenpopup.Image = ImageBank.winscreen;

            //set up lose screen
            loosescreenpopup = new GameObject();
            loosescreenpopup.Location = new Rectangle(170, 100, 500, 400);
            loosescreenpopup.Image = ImageBank.looseScreen;

            //set up reset and continue buttons
            resetButton = new GameObject();
            resetButton.Location = new Rectangle(370,380,80,35);

            continueButton = new GameObject();
            continueButton.Location = new Rectangle(resetButton.Location.Right+0, 380, 80, 40);

            //load list of levels
               // levels.Add("testLevel");
              // /*
            levels.Add("levelOne");
            levels.Add("levelTwo");
            levels.Add("levelThree");
            levels.Add("levelFour");
            levels.Add("levelFive");
            levels.Add("levelSix");
            levels.Add("levelSeven");//*/
            levels.Add("bossLevel");

            //create new map
            map = new Map(player);
            map.Load(levels[0]);

            //load background, set it in place
            background = new GameObject();
            background.Location = new Rectangle(0, 0, 800, 600);
            background.Image = ImageBank.background;
        }