Пример #1
0
        private static void Reset(GameWindow window, ContentManager content)
        {
            player.Reset(380, 400, 4f, 6f);

            enemies.Clear();
            Random    random    = new Random();
            Texture2D tmpSprite = content.Load <Texture2D>("LaxMineEnemy");

            for (int i = 0; i < 5; i++)
            {
                int  rndX = random.Next(0, window.ClientBounds.Width - tmpSprite.Width);
                int  rndY = random.Next(0, window.ClientBounds.Height / 2);
                Mine temp = new Mine(tmpSprite, rndX, rndY);
                enemies.Add(temp);
            }

            tmpSprite = content.Load <Texture2D>("laxtripod");
            for (int i = 0; i < 5; i++)
            {
                int    rndX = random.Next(0, window.ClientBounds.Width - tmpSprite.Width);
                int    rndY = random.Next(0, window.ClientBounds.Height / 2);
                Tripod temp = new Tripod(tmpSprite, rndX, rndY);
                enemies.Add(temp);
            }
        }
Пример #2
0
        public static void Reset(GameWindow window, ContentManager content, GameTime gameTime)
        {
            //sätter allt till orginal värden när player dör
            player.Reset(50, 200, 4f, 4f);
            enemies.Clear();
            bossD1.Clear();
            bossD2.Clear();
            wave          = 1;
            lv            = 1;
            player.points = 0;
            player.PW     = 0;
            j             = 0;
            int w = 0;

            timeSinceLastWave = 0;
            #region Enemy Wave
            Random random = new Random();

            if (gameTime.TotalGameTime.TotalSeconds > timeSinceLastWave + 9)
            {
                if (wave < 4)
                {
                    while (w < 1)
                    {
                        wave++; w++;
                    }
                }
                if (wave > 4 && wave < 9)
                {
                    while (w < 1)
                    {
                        wave++; w++;
                    }
                }
                timeSinceLastWave = gameTime.TotalGameTime.TotalSeconds;
            }

            #region Level 1
            if (lv == 1)
            {
                if (wave == 1)
                {
                    while (j < 1)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 10; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-fighter");
                        for (int i = 0; i < 10; i++)
                        {
                            int     rndX = random.Next(600, window.ClientBounds.Width);
                            int     rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Fighter temp = new Fighter(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 1;
                    }
                }
                if (wave == 2)
                {
                    while (j < 2)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 20; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-fighter");
                        for (int i = 0; i < 20; i++)
                        {
                            int     rndX = random.Next(600, window.ClientBounds.Width);
                            int     rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Fighter temp = new Fighter(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 2;
                    }
                }
                if (wave == 3)
                {
                    while (j < 3)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 30; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-fighter");
                        for (int i = 0; i < 30; i++)
                        {
                            int     rndX = random.Next(600, window.ClientBounds.Width);
                            int     rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Fighter temp = new Fighter(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 3;
                    }
                }
                if (wave == 4)
                {
                    while (j < 4)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/Boss/The_Death_Star");
                        for (int i = 0; i < 1; i++)
                        {
                            int  rndX = random.Next(650, window.ClientBounds.Width - tmpSprite.Width);
                            int  rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Boss temp = new Boss(tmpSprite, rndX, rndY);
                            bossD1.Add(temp);
                        }
                        j = 4;
                    }
                }
            }
            #endregion
            #region Level 2
            if (lv == 2)
            {
                if (wave == 6)
                {
                    while (j < 5)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 10; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Advanced");
                        for (int i = 0; i < 10; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Advanced temp = new Advanced(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 5;
                    }
                }
                if (wave == 7)
                {
                    while (j < 6)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 20; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Advanced");
                        for (int i = 0; i < 20; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Advanced temp = new Advanced(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 6;
                    }
                }
                if (wave == 8)
                {
                    while (j < 7)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Defender");
                        for (int i = 0; i < 30; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Defender temp = new Defender(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        tmpSprite = content.Load <Texture2D>("images/enemies/TIE-Advanced");
                        for (int i = 0; i < 30; i++)
                        {
                            int      rndX = random.Next(600, window.ClientBounds.Width);
                            int      rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Advanced temp = new Advanced(tmpSprite, rndX, rndY);
                            enemies.Add(temp);
                        }
                        j = 7;
                    }
                }
                if (wave == 9)
                {
                    while (j < 8)
                    {
                        Texture2D tmpSprite = content.Load <Texture2D>("images/enemies/Boss/Death-Star-2");
                        for (int i = 0; i < 1; i++)
                        {
                            int  rndX = random.Next(650, window.ClientBounds.Width - tmpSprite.Width);
                            int  rndY = random.Next(0, window.ClientBounds.Height - tmpSprite.Height);
                            Boss temp = new Boss(tmpSprite, rndX, rndY);
                            bossD2.Add(temp);
                        }
                        j = 8;
                    }
                }
            }
            #endregion
            #endregion
        }
 public static void Reset(GameWindow window, ContentManager content)
 {
     player.Reset(380, 400, 2.5f, 4.5f); //Reset player position
     enemies.Clear();                    // Remove remaining enemies
     powerups.Clear();                   // Remove remaining drops (coins, hearts, upgrades etc.)
 }