示例#1
0
 public Clouds(Level.LevelSelected level, GraphicsDevice gd, SpriteBatch sb, ContentManager cm, Random rand)
 {
     this._level = level;
     cloud = cm.Load<Texture2D>("Backgrounds/Clouds");
     this.rand = rand;
     this._Yoffset = rand.Next(-1000, -600);
     this._Xoffset = rand.Next(2000, 3000);
 }
        public Level CreateLevel1(Game game, GraphicsDeviceManager graphics, SpriteBatch spriteBatch)
        {
            Texture2D texture1 = Content.Load<Texture2D>("Images/Spikes");
            Sprite spikes = new Sprite(game, texture1, Vector2.Zero, spriteBatch, new EnemyType(Content, EnemyType.Etype.Simple));
            spikes.objectType = ObjectType.Spikes;
            spikes.Color = Color.White;
            Texture2D texture2 = Content.Load<Texture2D>("Images/swamp2");//SmallGreenMarsh");
            Sprite marsh = new Sprite(game, texture2, Vector2.Zero, spriteBatch, new EnemyType(Content, EnemyType.Etype.Simple));
            marsh.objectType = ObjectType.Marsh;

            List<Sprite> randomObjects = new List<Sprite>();
            randomObjects.Add(spikes);
            randomObjects.Add(marsh);

            Level level1 = new Level(graphics, spriteBatch, Content, Level.LevelSelected.Level1, randomObjects);
            level1.Name = "Level1";

            EnemyGroup eg1 = new EnemyGroup(Content, graphics, simple, 100, 2, Enemy.Direction.Left);
            EnemyGroup eg2 = new EnemyGroup(Content, graphics, simple, 100, 2, Enemy.Direction.Right);
            EnemyGroup eg3 = new EnemyGroup(Content, graphics, bombers, 300, 1, Enemy.Direction.Left);
            EnemyGroup eg4 = new EnemyGroup(Content, graphics, bombers, 300, 1, Enemy.Direction.Right);
            EnemyGroup eg5 = new EnemyGroup(Content, graphics, simple, 700, 2, Enemy.Direction.Left);
            EnemyGroup eg6 = new EnemyGroup(Content, graphics, simple, 700, 2, Enemy.Direction.Right);
            EnemyGroup eg7 = new EnemyGroup(Content, graphics, gunners, 1000, 2, Enemy.Direction.Right, false, true);
            EnemyGroup eg8 = new EnemyGroup(Content, graphics, gunners, 1000, 2, Enemy.Direction.Left, false, true);

            EnemyGroup eg9 = new EnemyGroup(Content, graphics, bombers, 1100, 2, Enemy.Direction.Left);
            EnemyGroup eg10 = new EnemyGroup(Content, graphics, bombers, 1100, 2, Enemy.Direction.Right);
            EnemyGroup eg11 = new EnemyGroup(Content, graphics, gunners, 1350, 1, Enemy.Direction.Right);
            EnemyGroup eg12 = new EnemyGroup(Content, graphics, gunners, 1600, 1, Enemy.Direction.Left);
            EnemyGroup eg13 = new EnemyGroup(Content, graphics, hards, 1600, 2, Enemy.Direction.Right);
            EnemyGroup eg14 = new EnemyGroup(Content, graphics, midBoss, 2000, 1, Enemy.Direction.Top, true); //change 1000 back to 2000

            level1.AddGroup(eg1);
            level1.AddGroup(eg2);
            level1.AddGroup(eg3);
            level1.AddGroup(eg4);
            level1.AddGroup(eg5);
            level1.AddGroup(eg6);
            level1.AddGroup(eg7);
            level1.AddGroup(eg8);

            level1.AddGroup(eg9);
            level1.AddGroup(eg10);
            level1.AddGroup(eg11);
            level1.AddGroup(eg12);
            level1.AddGroup(eg13);
            level1.AddGroup(eg14);

            return level1;
        }
 public void Update(long distanceTravelled, Level level)
 {
     if (distanceTravelled >= distanceToPop)
     {
         foreach(Enemy e in group)
         {
             level.enemies.Add(e);
         }
         if (this.isBoss)
             level.boss = true;
         else if (this.isMidBoss)
             level.midBoss = true;
         this.group.Clear();
     }
 }
        public StartLevel(GraphicsDeviceManager gdm, ContentManager cm, Level currentLevel)
        {
            this.gdm = gdm;
            opaqueRect = new Texture2D(gdm.GraphicsDevice, 1920, 680);

            font = cm.Load<SpriteFont>("Fonts/DefaultFont");
            this.level = currentLevel;

            backRectOpacity = 180/255f;
            backColor.A = 180;
            backColor.R = 40;
            backColor.G = 40;
            backColor.B = 40;
            opaqueRect.SetData(ColorPicker.setTexture(opaqueRect.Width, opaqueRect.Height, Color.Black));
        }
        public void Draw(SpriteBatch sb, Level currentLevel)
        {
            if (!BeginBackgroundCreditScroll)
            {
                sb.Begin();
                sb.Draw(background, new Rectangle(0, 0, 1920, 1080), Color.Black);
                sb.End();

                if (!string.IsNullOrEmpty(endMessage))
                {
                    sb.Begin();
                    sb.DrawString(font, endMessage, new Vector2(25, 500), Color.White);
                    sb.End();
                }
                if (!string.IsNullOrEmpty(otherMessage))
                {
                    sb.Begin();
                    sb.DrawString(font, otherMessage, new Vector2(50, 600), Color.White);
                    sb.End();
                }
            }
            else
            {
                sb.Begin();
                currentLevel.background.Draw(sb);
                sb.End();
                sb.Begin();
                currentLevel.border.Draw(sb);
                sb.End();
                sb.Begin();
                sb.Draw(background, new Rectangle(0, 0, 1920, 1080), Color.Black * .4f);
                sb.End();
                sb.Begin();
                sb.Draw(creditText, new Rectangle(0, 0, 1920, 1080), Color.White);
                sb.End();
            }
        }
 public Background(Level.LevelSelected level, GraphicsDevice gd, SpriteBatch sb, ContentManager cm)
 {
     this._level = level;
     _backGround = CreateBackground(gd, sb, cm);
 }
        public Level CreateLevel5(Game game, GraphicsDeviceManager graphics, SpriteBatch spriteBatch)
        {
            Texture2D texture1 = Content.Load<Texture2D>("Images/Spikes");
            Sprite spikes = new Sprite(game, texture1, Vector2.Zero, spriteBatch, new EnemyType(Content, EnemyType.Etype.Simple));
            spikes.objectType = ObjectType.Spikes;
            spikes.Color = Color.White;

            List<Sprite> randomObjects = new List<Sprite>();
            randomObjects.Add(spikes);

            Level level5 = new Level(graphics, spriteBatch, Content, Level.LevelSelected.Level5, randomObjects);

            level5.Name = "Level5";

            //Wave1
            EnemyGroup eg1 = new EnemyGroup(Content, graphics, simple, 100, 30, Enemy.Direction.Left);
            EnemyGroup eg2 = new EnemyGroup(Content, graphics, simple, 200, 30, Enemy.Direction.Right);
            EnemyGroup eg3 = new EnemyGroup(Content, graphics, bombers, 300, 15, Enemy.Direction.Left);
            EnemyGroup eg4 = new EnemyGroup(Content, graphics, bombers, 400, 15, Enemy.Direction.Right);
            EnemyGroup eg5 = new EnemyGroup(Content, graphics, gunners, 500, 20, Enemy.Direction.Right);
            EnemyGroup eg6 = new EnemyGroup(Content, graphics, gunners, 600, 20, Enemy.Direction.Left);
            EnemyGroup eg7 = new EnemyGroup(Content, graphics, simple, 700, 30, Enemy.Direction.Left);
            EnemyGroup eg8 = new EnemyGroup(Content, graphics, simple, 800, 30, Enemy.Direction.Right);

            //Midboss
            EnemyGroup eg9 = new EnemyGroup(Content, graphics, midBoss, 1000, 1, Enemy.Direction.Right, false, true);
            EnemyGroup eg10 = new EnemyGroup(Content, graphics, level2midboss, 1000, 3, Enemy.Direction.Left, false, true);
            EnemyGroup eg11 = new EnemyGroup(Content, graphics, midBoss, 1000, 1, Enemy.Direction.Top, false, true);
            EnemyGroup eg12 = new EnemyGroup(Content, graphics, level2midboss, 1000, 3, Enemy.Direction.Right, false, true);
            EnemyGroup eg13 = new EnemyGroup(Content, graphics, midBoss, 1000, 1, Enemy.Direction.Left, false, true);

            //Wave 2
            EnemyGroup eg14 = new EnemyGroup(Content, graphics, gunners, 1100, 25, Enemy.Direction.Left);
            EnemyGroup eg15 = new EnemyGroup(Content, graphics, gunners, 1200, 25, Enemy.Direction.Right);
            EnemyGroup eg16 = new EnemyGroup(Content, graphics, bombers, 1300, 20, Enemy.Direction.Right);
            EnemyGroup eg17 = new EnemyGroup(Content, graphics, bombers, 1400, 20, Enemy.Direction.Left);
            EnemyGroup eg18 = new EnemyGroup(Content, graphics, hards, 1500, 15, Enemy.Direction.Left);
            EnemyGroup eg19 = new EnemyGroup(Content, graphics, hards, 1600, 15, Enemy.Direction.Right);
            EnemyGroup eg20 = new EnemyGroup(Content, graphics, darting, 1700, 10, Enemy.Direction.Left);
            EnemyGroup eg21 = new EnemyGroup(Content, graphics, darting, 1800, 10, Enemy.Direction.Right);

            //Boss
            EnemyGroup eg22 = new EnemyGroup(Content, graphics, boss, 2000, 1, Enemy.Direction.Left, true);
            EnemyGroup eg23 = new EnemyGroup(Content, graphics, boss, 2000, 3, Enemy.Direction.Top, true);
            EnemyGroup eg24 = new EnemyGroup(Content, graphics, boss, 2000, 1, Enemy.Direction.Right, true);
            EnemyGroup eg25 = new EnemyGroup(Content, graphics, level3boss, 2000, 1, Enemy.Direction.Left, true);
            EnemyGroup eg26 = new EnemyGroup(Content, graphics, level3boss, 2000, 1, Enemy.Direction.Right, true);

            level5.AddGroup(eg1);
            level5.AddGroup(eg2);
            level5.AddGroup(eg3);
            level5.AddGroup(eg4);
            level5.AddGroup(eg5);
            level5.AddGroup(eg6);
            level5.AddGroup(eg7);
            level5.AddGroup(eg8);
            level5.AddGroup(eg9);
            level5.AddGroup(eg10);
            level5.AddGroup(eg11);
            level5.AddGroup(eg12);
            level5.AddGroup(eg13);

            level5.AddGroup(eg14);
            level5.AddGroup(eg15);
            level5.AddGroup(eg16);
            level5.AddGroup(eg17);
            level5.AddGroup(eg18);
            level5.AddGroup(eg19);
            level5.AddGroup(eg20);
            level5.AddGroup(eg21);
            level5.AddGroup(eg22);
            level5.AddGroup(eg23);
            level5.AddGroup(eg24);
            level5.AddGroup(eg25);
            level5.AddGroup(eg26);

            return level5;
        }
示例#8
0
        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            gameState = GameState.TitleScreen;
            previousState = gameState;

            upgradeScreen = null;
            startScreen = null;
            characterScreen = null;
            multiplayerLobby = null;
            deathScreen = null;
            levelBeginning = null;
            pauseScreen = null;
            loadingScreen = null;

            levelCreator = null;

            Random rand = new Random();
            currentLevel = null;

            enemies = null;
            explosions = null;
            shotBehavior = null;
            enemyShots = null;
            playerShots = null;
            hbOne = null;
            hbTwo = null;
            bossLifeBar = null;
            cbOne = null;
            cbTwo = null;
            backGroundMusic = null;
            playerOneMeterTitle = null;
            playerTwoMeterTitle = null;
            meterLabel = null;
            playerOneMarker = null;
            playerTwoMarker = null;

            dinosaurOne = null;
            dinosaurTwo = null;
            playerOneSprite = null;
            playerTwoSprite = null;
            collisions = null;
            font = null;

            playerOneCounter = 0;
            playerTwoCounter = 0;
            levelIncrement = 0;

            singlePlayer = false;
            explodedOne = false;
            explodedTwo = false;

            input = null;
            padInput = null;
        }
示例#9
0
 private void GenerateLevel()
 {
     if (levelBeginning.LevelCount == 1)
     {
         currentLevel = levelCreator.CreateLevel1(this, graphics, spriteBatch);
     }
     else if (levelBeginning.LevelCount == 2)
     {
         currentLevel = levelCreator.CreateLevel2(this, graphics, spriteBatch);
     }
     else if (levelBeginning.LevelCount == 3)
     {
         currentLevel = levelCreator.CreateLevel3(this, graphics, spriteBatch);
     }
     else if (levelBeginning.LevelCount == 4)
     {
         currentLevel = levelCreator.CreateLevel4(this, graphics, spriteBatch);
     }
     else if (levelBeginning.LevelCount == 5)
     {
         currentLevel = levelCreator.CreateLevel5(this, graphics, spriteBatch);
     }
     levelBeginning.level = currentLevel;
 }