Esempio n. 1
0
        public static void loadLevel(int levelNumber)
        {
            EnemyManager.clear();
            PickUpManager.clear();
            if (levelNumber != m_LevelNumber)
            {
                m_LevelNumber = levelNumber;
            }
            //TODO: call enemy manager clear
            BackgroundMusic.playSong(levelNumber, 0.30f);
            string level = "Content/Level" + levelNumber + ".txt";

            parseData(level);
            if (levelNumber >= 3)
            {
                Background.loadContent(Content, 3, 1);
            }
            else
            {
                Background.loadContent(Content, levelNumber + 1, 1);
            }
            if (levelNumber == 3)
            {
                Boss.IsActive = true;;
            }
            Player.reset();
            Player.setInitialPosition();
            EnemyManager.loadContent(Content);
            GateManager.reset();
            GateManager.loadContent(Content);
            PickUpManager.loadContent(Content);
        }
Esempio n. 2
0
 public static void reset()
 {
     for (int i = 0; i < gates.Count; i++)
     {
         gates.Clear();
         GateManager.loadContent(Content);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager    = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager  = new PickUpManager();
            tiles          = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player(new Vector2(200, 1000), new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128, 64));
            player.loadContent(Content);



            camera        = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }
Esempio n. 4
0
        public static bool enemyCheck(int i, int j, string character)
        {
            Vector2 temp = new Vector2(m_DestinationRectangle.Width / 2, m_DestinationRectangle.Height / 2);

            switch (character)
            {
            case "0":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.BEES);
                return(true);

            case "1":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.SPIDER);
                return(true);

            case "2":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.PIXIE);
                return(true);

            case "3":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.IMP);
                return(true);

            case "4":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.UNDEADUNICORN);
                return(true);

            case "6":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                PickUpManager.addEnemy(temp, PickUpType.STAR);
                return(true);

            case "7":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                GateManager.addEnemy(temp);
                return(true);

            case "8":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                PickUpManager.addEnemy(temp, PickUpType.KEY);
                return(true);

            case "9":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                PickUpManager.addEnemy(temp, PickUpType.HEART);
                return(true);

            case "!":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.BUNNY);
                return(true);

            case "@":
                temp.Y += m_DestinationRectangle.Height * i;
                temp.X += m_DestinationRectangle.Width * j;
                EnemyManager.addEnemy(temp, EnemyType.BUTTERFLY);
                return(true);

            default:
                return(false);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager = new PickUpManager();
            tiles = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player( new Vector2(200, 1000),new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128,64 ));
            player.loadContent(Content);

            camera = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }