Esempio n. 1
0
        public void ResetContent()
        {
            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            sprites = new List<ISprite>();
            movSprites = new List<Sprite>();
            ssprites = new List<Sprite>();
            victoryScreen = new VictoryScreen(game);
            gameOverScreen = new GameOverScreen(game);

            mario = new Mario(game, this);
            // Create a camera instance and limit its moving range
            _camera = new Camera(game.GraphicsDevice.Viewport);

            // Create 9 layers with parallax ranging from 0% to 100% (only horizontal)
            _layers = new Layer[9];
            hud = new HUD(game, mario);
            parser = new Parser(game);
            if (Map == 1)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map.xml");

            }
            else if (Map == 2)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map2.xml");
            }
            else if (Map == 3)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map3.xml");
            }

            isPaused = false;
            isMuted = false;
            victory = false;
            defeat = false;
            SoundEffect effect = game.Content.Load<SoundEffect>("OriginalThemeSong");
            instance = effect.CreateInstance();
            instance.IsLooped = true;
            instance.Play();

            quad = new Quadtree(0, new CollisionBox(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height));
            secquad = new Quadtree(0, new CollisionBox(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height));

            collision = new MarioCollision(mario, this);
            sec_collision = new OtherCollision(mario, this, secquad);
            ////////////////////////////

            //this.Mute();
            ////////////////////////////////

            screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

            Font1 = game.Content.Load<SpriteFont>("MarioPoints");
            keyboardCont = new KeyboardController(game, mario);
            gamePadCont = new GamePadController(game, mario);
            // TODO: use this.Content to load your game content here
        }
Esempio n. 2
0
        public void ChooseContent()
        {
            sprites = new List<ISprite>();
            movSprites = new List<Sprite>();
            ssprites = new List<Sprite>();
            // Create a camera instance and limit its moving range
            _camera = new Camera(game.GraphicsDevice.Viewport) { Limits = new Rectangle(0, 0, 4000, 600) };

            // Create 9 layers with parallax ranging from 0% to 100% (only horizontal)
            _layers = new Layer[9];
            hud = new HUD(game, mario);
            parser = new Parser(game);
            if (Map == 1)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map.xml");

            }
            else if (Map == 2)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map2.xml");
            }
            else if (Map == 3)
            {
                parser.Parse(mario, sprites, movSprites, ssprites, _layers, _camera, "map3.xml");
            }
            quad = new Quadtree(0, new CollisionBox(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height));
            secquad = new Quadtree(0, new CollisionBox(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height));

            collision = new MarioCollision(mario, this);
            sec_collision = new OtherCollision(mario, this, secquad);
        }