Esempio n. 1
0
        //Detect Collisions for everything
        private void DetectCollisions()
        {
            #region Player vs Asteroids
            if (spawntimer >= spawninterval)
            {
                #region Asteroid1
                for (int i = 0; i <= NumAsteroid1 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid1, asteroid1List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid1, asteroid1List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            dead = true;
                        }
                    }
                }
                #endregion
            }
            if (spawntimer >= spawninterval)
            {
                #region Asteroid2
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid2, asteroid2List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid2, asteroid2List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            dead = true;
                        }
                    }
                }
                #endregion
            }
            if (spawntimer >= spawninterval)
            {
                #region Asteroid3
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid3, asteroid3List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid3, asteroid3List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            dead = true;
                        }
                    }
                }
                #endregion
            }

            #endregion

            #region Asteroids vs Bullets

            #region Asteroid1
            for (int i = 0; i <= NumAsteroid1 - 1; i++)
            {
                bulletCollide = collision.BulletsCollide(ammo, Asteroid1, asteroid1List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide == true)
                {
                    Score += 10;
                    #region Remove bullets
                    bulletCollide = false;
                    BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    asteroid1List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                        if (asteroid1List[i].lives == 0)
                        {
                            SpawnAsteroids(asteroid1List[i].asteroidModel, asteroid1List[i].position);

                            Score += 100;
                            asteroid1List[i] = new Asteroid(Asteroid1, new Vector3(8000, 8000, 0), 0.0f, false, 0);

                            asteroidsonscreen -= 1;
                            Explosion.Play(0.5F);
                        }

                    #endregion
                }
            }
            #endregion

            #region Asteroid 2
            for (int i = 0; i <= NumAsteroid2 - 1; i++)
            {
                bulletCollide2 = collision.BulletsCollide(ammo, Asteroid2, asteroid2List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide2 == true)
                {
                    Score += 10;
                    #region Remove bullets
                    BulletList[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    bulletCollide2 = false;
                    asteroid2List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid2List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid2List[i].asteroidModel, asteroid2List[i].position);

                        Score += 50;
                        asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid3
            for (int i = 0; i <= NumAsteroid3 - 1; i++)
            {
                bulletCollide3 = collision.BulletsCollide(ammo, Asteroid3, asteroid3List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide3 == true)
                {
                    Score += 10;
                    #region Remove bullets
                    BulletList[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    bulletCollide3 = false;
                    asteroid3List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid3List[i].lives == 0)
                    {
                        Score += 20;
                        asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;
                        //just using asteroidlist1 at the moment, adapt for all models

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #endregion

            #region UFO and bullets
            for (int i = 0; i <= noBullets - 1; i++)
            {
                collide = collision.pBulletsCollide(ammo, ufo, saucer.position, BulletList[0].AmmoModelPosition, Content);
                if (collide == true)
                {
                    Score += 10;
                    #region Remove bullets
                    collide = false;
                    BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    #endregion

                    collide = false;
                    saucer.Lives -= 1;

                    if (saucer.Lives == 0)
                    {
                        Explosion.Play(0.5F);
                        Score += 500;
                        saucer = new UFO(ufo, new Vector3(9000, 9000, 0), 0, 0, false);
                        saucer.isAlive = false;
                    }
                }
            }
            #endregion

            if (spawntimer >= spawninterval)
            {
                #region Ufo and player
                collide = collision.PlayersvPlayer(myModel, ufo, play.position, saucer.position, Content);
                if (collide == true)
                {
                    spawntimer = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play.position.X = x.Next(-2000, 2000);
                    play.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play.Lives -= 1;
                    saucer.Lives -= 1;
                    if (play.Lives == 0)
                    {
                        dead = true;
                    }
                    if (saucer.Lives == 0)
                    {
                        Explosion.Play(0.5F);
                        saucer = new UFO(ufo, new Vector3(9000, 9000, 0), 0, 0, false);
                        saucer.isAlive = false;
                    }
                }
                #endregion
            }

            if (spawntimer >= spawninterval)
            {
                #region player vs ufo bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    collide = collision.pBulletsCollide(ammo, myModel, play.position, ufoBulletList[0].AmmoModelPosition, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        ufoBulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        ufoBulletList[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play.position.X = x.Next(-2000, 2000);
                        play.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play.Lives -= 1;

                        if (play.Lives == 0)
                        {
                            dead = true;
                        }
                    }
                }
                #endregion
            }
        }
Esempio n. 2
0
        public override void LoadContent()
        {
            if (Content == null)
                Content = new ContentManager(ScreenManager.Game.Services, "Content");

            #region loaded content

            myModel = Content.Load<Model>("Model\\fighter");
            Asteroid1 = Content.Load<Model>("Model\\Asteroid1");
            Asteroid2 = Content.Load<Model>("Model\\Asteroid2");
            Asteroid3 = Content.Load<Model>("Model\\Asteroid3");
            ammo = Content.Load<Model>("Model\\ammo");
            ufo = Content.Load<Model>("Model\\UFO");
            venus = Content.Load<Model>("Model\\venus");

            Explosion = Content.Load<SoundEffect>("Audio\\explosion3");

            dataScreen = Content.Load<Texture2D>("Images\\DataScreen");
            BackGround = Content.Load<Texture2D>("Images\\background2");
            panel = Content.Load<Texture2D>("Images\\panel");
            hypButton = Content.Load<Texture2D>("Images\\p1hyp");
            hypButtonClk = Content.Load<Texture2D>("Images\\p1hypclk");

            ufoFire = Content.Load<SoundEffect>("Audio\\tx0_fire1");
            Engine = Content.Load<SoundEffect>("Audio\\engine_3");
            WeaponFire = Content.Load<SoundEffect>("Audio\\pdp1_fire");

            defaultFont = Content.Load<SpriteFont>("Fonts\\defaultFont");
            HyperSpace = Content.Load<SoundEffect>("Audio\\hax2_fire_alt");

            play = new Player(myModel, Initial, 0.0f, 3);
            saucer = new UFO(ufo, new Vector3(9000, 9000, 0), 0.0f, 5, false);

            Projectile bullet = new Projectile(ammo, Initial, 0.0f, Initial, false, Initial);

            ufoque = new float[] { 4000, 36000, 36000 };
            BulletList = new Projectile[noBullets];
            ufoBulletList = new Projectile[noBullets];

            #endregion

            #region Graphic Device and screen elements
            screenWidth = ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth;
            screenHeight = ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight;
            aspectRatio = ScreenManager.GraphicsDevice.Viewport.AspectRatio;
            #endregion

            #region initialise Asteroids
            AP1.X = -2000;
            AP1.Y = screenHeight;

            AP2.X = -screenWidth;
            AP2.Y = -2000;

            AP3.X = 500;
            AP3.Y = -screenHeight;

            AP4.X = screenWidth;
            AP4.Y = 750;

            asteroid1List[0] = new Asteroid(Asteroid1, AP1, 0.5f, true, 5);
            asteroid1List[1] = new Asteroid(Asteroid1, AP2, 1.25f, true, 5);
            asteroid1List[2] = new Asteroid(Asteroid1, AP3, 2.005f, true, 5);

            asteroid2List[0] = new Asteroid(Asteroid2, AP4, 0.005f, true, 3);

            for (int i = 1; i < NumAsteroid2; i++)
                asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(4000, 4000, 0), 0.005f, false, 3);

            for (int i = 0; i < NumAsteroid3; i++)
                asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(4000, 4000, 0), 0.005f, false, 1);

            #endregion

            #region initialise bullet list
            for (int i = 0; i < noBullets; i++)
            {
                BulletList[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
                ufoBulletList[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
            }
            #endregion
        }
Esempio n. 3
0
        //Detect Collisions for everything
        private void DetectCollisions()
        {
            #region Players vs Players

            #region Player 1 & Player 2
            if ((spawntimer > spawninterval) && (spawntimer2 > spawninterval) && (p1dead == false) && (p2dead == false))
            {
                collide = collision.PlayersvPlayer(myModel, Player2, play.position, play2.position, Content);
                if (collide == true)
                {
                    spawntimer = 0;
                    spawntimer2 = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play.position.X = x.Next(-2000, 2000);
                    play.position.Y = y.Next(-2000, 2000);

                    play2.position.X = x.Next(-2000, 2000);
                    play2.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play.Lives -= 1;
                    play2.Lives -= 1;
                    if (play.Lives == 0)
                    {
                        p1dead = true;
                    }
                    if (play2.Lives == 0)
                    {
                        p2dead = true;
                    }
                }
            }
            #endregion

            #region Player 2 & Player 3
            if ((spawntimer2 > spawninterval) && (spawntimer3 > spawninterval) && (p2dead == false) && (p3dead == false))
            {
                collide = collision.PlayersvPlayer(Player2, Player3, play2.position, play3.position, Content);
                if (collide == true)
                {
                    spawntimer2 = 0;
                    spawntimer3 = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play2.position.X = x.Next(-2000, 2000);
                    play2.position.Y = y.Next(-2000, 2000);

                    play3.position.X = x.Next(-2000, 2000);
                    play3.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play2.Lives -= 1;
                    play3.Lives -= 1;
                    if (play2.Lives == 0)
                    {
                        p2dead = true;
                    }
                    if (play3.Lives == 0)
                    {
                        p3dead = true;
                    }
                }
            }
            #endregion

            #region Player 3 & Player 1
            if ((spawntimer3 > spawninterval) && (spawntimer > spawninterval) && (p3dead == false) && (p1dead == false))
            {
                collide = collision.PlayersvPlayer(Player3, myModel, play3.position, play.position, Content);
                if (collide == true)
                {
                    spawntimer = 0;
                    spawntimer3 = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play3.position.X = x.Next(-2000, 2000);
                    play3.position.Y = y.Next(-2000, 2000);

                    play.position.X = x.Next(-2000, 2000);
                    play.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play3.Lives -= 1;
                    play.Lives -= 1;
                    if (play3.Lives == 0)
                    {
                        p3dead = true;
                    }
                    if (play.Lives == 0)
                    {
                        p1dead = true;
                    }
                }
            }
            #endregion

            #region Player 4 & Player 1
            if ((spawntimer4 > spawninterval) && (spawntimer > spawninterval) && (p4dead == false) && (p1dead == false))
            {
                collide = collision.PlayersvPlayer(Player4, myModel, play4.position, play.position, Content);
                if (collide == true)
                {
                    spawntimer4 = 0;
                    spawntimer = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play4.position.X = x.Next(-2000, 2000);
                    play4.position.Y = y.Next(-2000, 2000);

                    play.position.X = x.Next(-2000, 2000);
                    play.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play4.Lives -= 1;
                    play.Lives -= 1;
                    if (play4.Lives == 0)
                    {
                        p4dead = true;
                    }
                    if (play.Lives == 0)
                    {
                        p1dead = true;
                    }
                }
            }
            #endregion

            #region Player 4 & Player 2
            if ((spawntimer4 > spawninterval) && (spawntimer2 > spawninterval) && (p4dead == false) && (p2dead == false))
            {
                collide = collision.PlayersvPlayer(Player4, Player2, play4.position, play2.position, Content);
                if (collide == true)
                {
                    spawntimer4 = 0;
                    spawntimer2 = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play4.position.X = x.Next(-2000, 2000);
                    play4.position.Y = y.Next(-2000, 2000);

                    play2.position.X = x.Next(-2000, 2000);
                    play2.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play4.Lives -= 1;
                    play2.Lives -= 1;
                    if (play4.Lives == 0)
                    {
                        p4dead = true;
                    }
                    if (play2.Lives == 0)
                    {
                        p2dead = true;
                    }
                }
            }
            #endregion

            #region Player 4 & Player 3
            if ((spawntimer4 > spawninterval) && (spawntimer3 > spawninterval) && (p4dead == false) && (p3dead == false))
            {
                collide = collision.PlayersvPlayer(Player4, Player3, play4.position, play3.position, Content);
                if (collide == true)
                {
                    spawntimer4 = 0;
                    spawntimer3 = 0;
                    Random x = new Random();
                    Random y = new Random();
                    play4.position.X = x.Next(-2000, 2000);
                    play4.position.Y = y.Next(-2000, 2000);

                    play3.position.X = x.Next(-2000, 2000);
                    play3.position.Y = y.Next(-2000, 2000);
                    collide = false;
                    play4.Lives -= 1;
                    play3.Lives -= 1;
                    if (play4.Lives == 0)
                    {
                        p4dead = true;
                    }
                    if (play3.Lives == 0)
                    {
                        p3dead = true;
                    }
                }
            }
            #endregion

            #endregion

            #region Player vs Asteroids
            #region Player1

            if ((spawntimer >= spawninterval) && (p1dead == false))
            {
                #region Asteroid1
                for (int i = 0; i <= NumAsteroid1 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid1, asteroid1List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid1, asteroid1List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            p1dead = true;
                        }

                    }
                }
                #endregion
            }
            if ((spawntimer >= spawninterval) && (p1dead == false))
            {
                #region Asteroid2
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid2, asteroid2List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid2, asteroid2List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            p1dead = true;
                        }

                    }
                }
                #endregion
            }
            if ((spawntimer >= spawninterval) && (p1dead == false))
            {
                #region Asteroid3
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    collide = collision.playerCollide(myModel, Asteroid3, asteroid3List[i].position, play.position, Content);
                    if (collide == true)
                    {
                        spawntimer = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play.position.X = x.Next(-2000, 2000);
                            play.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(myModel, Asteroid3, asteroid3List[i].position, play.position, Content);
                        }
                        collide = false;
                        play.Lives -= 1;
                        if (play.Lives == 0)
                        {
                            p1dead = true;
                        }

                    }
                }
                #endregion
            }

            #endregion

            #region Player2
            if ((spawntimer2 >= spawninterval) && (p2dead == false))
            {
                #region Asteroid1
                for (int i = 0; i <= NumAsteroid1 - 1; i++)
                {

                    collide = collision.playerCollide(Player2, Asteroid1, asteroid1List[i].position, play2.position, Content);
                    if (collide == true)
                    {
                        spawntimer2 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play2.position.X = x.Next(-2000, 2000);
                            play2.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player2, Asteroid1, asteroid1List[i].position, play2.position, Content);
                        }
                        collide = false;
                        play2.Lives -= 1;
                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer2 >= spawninterval) && (p2dead == false))
            {
                #region Asteroid2
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {

                    collide = collision.playerCollide(Player2, Asteroid2, asteroid2List[i].position, play2.position, Content);
                    if (collide == true)
                    {
                        spawntimer2 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play2.position.X = x.Next(-2000, 2000);
                            play2.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player2, Asteroid2, asteroid2List[i].position, play2.position, Content);
                        }
                        collide = false;
                        play2.Lives -= 1;
                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer2 >= spawninterval) && (p2dead == false))
            {
                #region Asteroid3
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    collide = collision.playerCollide(Player2, Asteroid3, asteroid3List[i].position, play2.position, Content);
                    if (collide == true)
                    {
                        spawntimer2 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play2.position.X = x.Next(-2000, 2000);
                            play2.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player2, Asteroid3, asteroid3List[i].position, play2.position, Content);
                        }
                        collide = false;
                        play2.Lives -= 1;
                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }
                #endregion
            }
            #endregion

            #region Player3
            if ((spawntimer3 >= spawninterval) && (p3dead == false))
            {
                #region Asteroid1
                for (int i = 0; i <= NumAsteroid1 - 1; i++)
                {

                    collide = collision.playerCollide(Player3, Asteroid1, asteroid1List[i].position, play3.position, Content);
                    if (collide == true)
                    {
                        spawntimer3 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play3.position.X = x.Next(-2000, 2000);
                            play3.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player3, Asteroid1, asteroid1List[i].position, play3.position, Content);
                        }
                        collide = false;
                        play3.Lives -= 1;
                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer3 >= spawninterval) && (p3dead == false))
            {
                #region Asteroid2
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {

                    collide = collision.playerCollide(Player3, Asteroid2, asteroid2List[i].position, play3.position, Content);
                    if (collide == true)
                    {
                        spawntimer3 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play3.position.X = x.Next(-2000, 2000);
                            play3.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player3, Asteroid2, asteroid2List[i].position, play3.position, Content);
                        }
                        collide = false;
                        play3.Lives -= 1;
                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer3 >= spawninterval) && (p3dead == false))
            {
                #region Asteroid3
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    collide = collision.playerCollide(Player3, Asteroid3, asteroid3List[i].position, play3.position, Content);
                    if (collide == true)
                    {
                        spawntimer3 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play3.position.X = x.Next(-2000, 2000);
                            play3.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player3, Asteroid3, asteroid3List[i].position, play3.position, Content);
                        }
                        collide = false;
                        play3.Lives -= 1;
                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }
                #endregion
            }
            #endregion

            #region Player4
            if ((spawntimer4 >= spawninterval) && (p4dead == false))
            {
                #region Asteroid1
                for (int i = 0; i <= NumAsteroid1 - 1; i++)
                {

                    collide = collision.playerCollide(Player4, Asteroid1, asteroid1List[i].position, play4.position, Content);
                    if (collide == true)
                    {
                        spawntimer4 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play4.position.X = x.Next(-2000, 2000);
                            play4.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player4, Asteroid1, asteroid1List[i].position, play4.position, Content);
                        }
                        collide = false;
                        play4.Lives -= 1;
                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer4 >= spawninterval) && (p4dead == false))
            {
                #region Asteroid2
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {

                    collide = collision.playerCollide(Player4, Asteroid2, asteroid2List[i].position, play4.position, Content);
                    if (collide == true)
                    {
                        spawntimer4 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play4.position.X = x.Next(-2000, 2000);
                            play4.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player4, Asteroid2, asteroid2List[i].position, play4.position, Content);
                        }
                        collide = false;
                        play4.Lives -= 1;
                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer4 >= spawninterval) && (p4dead == false))
            {
                #region Asteroid3
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    collide = collision.playerCollide(Player4, Asteroid3, asteroid3List[i].position, play4.position, Content);
                    if (collide == true)
                    {
                        spawntimer4 = 0;
                        while (collide == true)
                        {
                            Random x = new Random();
                            Random y = new Random();
                            play4.position.X = x.Next(-2000, 2000);
                            play4.position.Y = y.Next(-2000, 2000);
                            collide = collision.playerCollide(Player4, Asteroid2, asteroid2List[i].position, play4.position, Content);
                        }
                        collide = false;
                        play4.Lives -= 1;
                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }
            #endregion

            #endregion

            #region Asteroids vs Bullets

            #region Player1
            #region Asteroid1
            for (int i = 0; i <= NumAsteroid1 - 1; i++)
            {
                bulletCollide = collision.BulletsCollide(ammo, Asteroid1, asteroid1List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide == true)
                {
                    #region Remove bullets
                    bulletCollide = false;
                    BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    asteroid1List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid1List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid1List[i].asteroidModel, asteroid1List[i].position);

                        asteroid1List[i] = new Asteroid(Asteroid1, new Vector3(8000, 8000, 0), 0.0f, false, 0);

                        asteroidsonscreen -= 1;
                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid 2
            for (int i = 0; i <= NumAsteroid2 - 1; i++)
            {
                bulletCollide2 = collision.BulletsCollide(ammo, Asteroid2, asteroid2List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide2 == true)
                {

                    #region Remove bullets
                    BulletList[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    bulletCollide2 = false;
                    asteroid2List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid2List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid2List[i].asteroidModel, asteroid2List[i].position);

                        asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid3
            for (int i = 0; i <= NumAsteroid3 - 1; i++)
            {
                bulletCollide3 = collision.BulletsCollide(ammo, Asteroid3, asteroid3List[i].position, BulletList[0].AmmoModelPosition, Content);
                if (bulletCollide3 == true)
                {
                    #region Remove bullets
                    BulletList[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    BulletList[0].AmmoFlying = false;
                    bulletCollide3 = false;
                    asteroid3List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid3List[i].lives == 0)
                    {

                        asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;
                        //just using asteroidlist1 at the moment, adapt for all models

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion
            #endregion

            #region Player2
            #region Asteroid1
            for (int i = 0; i <= NumAsteroid1 - 1; i++)
            {
                bulletCollide = collision.BulletsCollide(ammo, Asteroid1, asteroid1List[i].position, Bullet2List[0].AmmoModelPosition, Content);
                if (bulletCollide == true)
                {
                    #region Remove bullets
                    bulletCollide = false;
                    Bullet2List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    Bullet2List[0].AmmoFlying = false;
                    asteroid1List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid1List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid1List[i].asteroidModel, asteroid1List[i].position);

                        asteroid1List[i] = new Asteroid(Asteroid1, new Vector3(8000, 8000, 0), 0.0f, false, 0);

                        asteroidsonscreen -= 1;
                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid 2
            for (int i = 0; i <= NumAsteroid2 - 1; i++)
            {
                bulletCollide2 = collision.BulletsCollide(ammo, Asteroid2, asteroid2List[i].position, Bullet2List[0].AmmoModelPosition, Content);
                if (bulletCollide2 == true)
                {
                    #region Remove bullets
                    Bullet2List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet2List[0].AmmoFlying = false;
                    bulletCollide2 = false;
                    asteroid2List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid2List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid2List[i].asteroidModel, asteroid2List[i].position);

                        asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid3
            for (int i = 0; i <= NumAsteroid3 - 1; i++)
            {
                bulletCollide3 = collision.BulletsCollide(ammo, Asteroid3, asteroid3List[i].position, Bullet2List[0].AmmoModelPosition, Content);
                if (bulletCollide3 == true)
                {
                    #region Remove bullets
                    Bullet2List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet2List[0].AmmoFlying = false;
                    bulletCollide3 = false;
                    asteroid3List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid3List[i].lives == 0)
                    {
                        asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;
                        //just using asteroidlist1 at the moment, adapt for all models

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion
            #endregion

            #region Player3
            #region Asteroid1
            for (int i = 0; i <= NumAsteroid1 - 1; i++)
            {
                bulletCollide = collision.BulletsCollide(ammo, Asteroid1, asteroid1List[i].position, Bullet3List[0].AmmoModelPosition, Content);
                if (bulletCollide == true)
                {
                    #region Remove bullets
                    bulletCollide = false;
                    Bullet3List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    Bullet3List[0].AmmoFlying = false;
                    asteroid1List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid1List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid1List[i].asteroidModel, asteroid1List[i].position);

                        asteroid1List[i] = new Asteroid(Asteroid1, new Vector3(8000, 8000, 0), 0.0f, false, 0);

                        asteroidsonscreen -= 1;
                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid 2
            for (int i = 0; i <= NumAsteroid2 - 1; i++)
            {
                bulletCollide2 = collision.BulletsCollide(ammo, Asteroid2, asteroid2List[i].position, Bullet3List[0].AmmoModelPosition, Content);
                if (bulletCollide2 == true)
                {
                    #region Remove bullets
                    Bullet3List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet3List[0].AmmoFlying = false;
                    bulletCollide2 = false;
                    asteroid2List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid2List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid2List[i].asteroidModel, asteroid2List[i].position);

                        asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid3
            for (int i = 0; i <= NumAsteroid3 - 1; i++)
            {
                bulletCollide3 = collision.BulletsCollide(ammo, Asteroid3, asteroid3List[i].position, Bullet3List[0].AmmoModelPosition, Content);
                if (bulletCollide3 == true)
                {
                    #region Remove bullets
                    Bullet3List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet3List[0].AmmoFlying = false;
                    bulletCollide3 = false;
                    asteroid3List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid3List[i].lives == 0)
                    {
                        asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;
                        //just using asteroidlist1 at the moment, adapt for all models

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion
            #endregion

            #region Player4
            #region Asteroid1
            for (int i = 0; i <= NumAsteroid1 - 1; i++)
            {
                bulletCollide = collision.BulletsCollide(ammo, Asteroid1, asteroid1List[i].position, Bullet4List[0].AmmoModelPosition, Content);
                if (bulletCollide == true)
                {
                    #region Remove bullets
                    bulletCollide = false;
                    Bullet4List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                    Bullet4List[0].AmmoFlying = false;
                    asteroid1List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid1List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid1List[i].asteroidModel, asteroid1List[i].position);

                        asteroid1List[i] = new Asteroid(Asteroid1, new Vector3(8000, 8000, 0), 0.0f, false, 0);

                        asteroidsonscreen -= 1;
                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid 2
            for (int i = 0; i <= NumAsteroid2 - 1; i++)
            {
                bulletCollide2 = collision.BulletsCollide(ammo, Asteroid2, asteroid2List[i].position, Bullet4List[0].AmmoModelPosition, Content);
                if (bulletCollide2 == true)
                {
                    #region Remove bullets
                    Bullet4List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet4List[0].AmmoFlying = false;
                    bulletCollide2 = false;
                    asteroid2List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid2List[i].lives == 0)
                    {
                        SpawnAsteroids(asteroid2List[i].asteroidModel, asteroid2List[i].position);

                        asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion

            #region Asteroid3
            for (int i = 0; i <= NumAsteroid3 - 1; i++)
            {
                bulletCollide3 = collision.BulletsCollide(ammo, Asteroid3, asteroid3List[i].position, Bullet4List[0].AmmoModelPosition, Content);
                if (bulletCollide3 == true)
                {
                    #region Remove bullets
                    Bullet4List[0].AmmoModelPosition = new Vector3(5000f, 5000f, 0.0f);
                    Bullet4List[0].AmmoFlying = false;
                    bulletCollide3 = false;
                    asteroid3List[i].lives -= 1;
                    #endregion

                    #region Out of lives
                    if (asteroid3List[i].lives == 0)
                    {
                        asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(8000, 8000, 0), 0.0f, false, 0);
                        asteroidsonscreen -= 1;
                        //just using asteroidlist1 at the moment, adapt for all models

                        Explosion.Play(0.5F);

                    }
                    #endregion
                }
            }
            #endregion
            #endregion

            #endregion*/

            #region Player vs bullets
            #region Player 1 & Player 2
            if ((spawntimer >= spawninterval) && (p1dead == false))
            {
                #region player vs player2 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, myModel, play.position, Bullet2List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet2List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet2List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play.position.X = x.Next(-2000, 2000);
                        play.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play.Lives -= 1;

                        if (play.Lives == 0)
                        {
                            p1dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer2 >= spawninterval) && (p1dead == false))
            {
                #region player2 vs player bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player2, play2.position, BulletList[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer2 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        BulletList[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play2.position.X = x.Next(-2000, 2000);
                        play2.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play2.Lives -= 1;

                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion

            #region Player 2 & Player 3
            if ((spawntimer2 >= spawninterval) && (p2dead == false))
            {
                #region player2 vs player3 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player2, play2.position, Bullet3List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer2 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet3List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet3List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play2.position.X = x.Next(-2000, 2000);
                        play2.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play2.Lives -= 1;

                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer3 >= spawninterval) && (p2dead == false))
            {
                #region player3 vs player2 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player3, play3.position, Bullet2List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer3 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet2List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet2List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play3.position.X = x.Next(-2000, 2000);
                        play3.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play3.Lives -= 1;

                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion

            #region Player 3 & Player 1
            if ((spawntimer3 >= spawninterval) && (p3dead == false))
            {
                #region player3 vs player1 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player3, play3.position, BulletList[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer3 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        BulletList[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play3.position.X = x.Next(-2000, 2000);
                        play3.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play3.Lives -= 1;

                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer >= spawninterval) && (p3dead == false))
            {
                #region player1 vs player3 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, myModel, play.position, Bullet3List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet3List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet3List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play.position.X = x.Next(-2000, 2000);
                        play.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play.Lives -= 1;

                        if (play.Lives == 0)
                        {
                            p1dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion

            #region Player 4 & Player 1
            if ((spawntimer4 >= spawninterval)&&(p4dead==false))
            {
                #region player4 vs player1 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player4, play4.position, BulletList[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer4 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        BulletList[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        BulletList[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play4.position.X = x.Next(-2000, 2000);
                        play4.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play4.Lives -= 1;

                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer >= spawninterval) && (p4dead == false))
            {
                #region player1 vs player4 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, myModel, play.position, Bullet4List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet3List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet3List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play4.position.X = x.Next(-2000, 2000);
                        play4.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play4.Lives -= 1;

                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion

            #region Player 4 & Player 2
            if ((spawntimer4 >= spawninterval)&&(p4dead==false))
            {
                #region player4 vs player2 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player4, play4.position, Bullet2List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer4 = 0;

                        #region Remove bullets
                        bulletCollide = false;
                        Bullet2List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet2List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play4.position.X = x.Next(-2000, 2000);
                        play4.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play4.Lives -= 1;

                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer2 >= spawninterval)&&(p4dead==false))
            {
                #region player2 vs player4 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player2, play2.position, Bullet4List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer2 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet4List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet4List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play2.position.X = x.Next(-2000, 2000);
                        play2.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play2.Lives -= 1;

                        if (play2.Lives == 0)
                        {
                            p2dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion

            #region Player 4 & Player 3
            if ((spawntimer4 >= spawninterval)&&(p4dead==false))
            {
                #region player4 vs player3 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player4, play4.position, Bullet3List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer4 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet3List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet3List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play4.position.X = x.Next(-2000, 2000);
                        play4.position.Y = y.Next(-2000, 2000);
                        collide = false;
                        play4.Lives -= 1;

                        if (play4.Lives == 0)
                        {
                            p4dead = true;
                        }
                    }
                }
                #endregion
            }

            if ((spawntimer3 >= spawninterval) && (p4dead == false))
            {
                #region player3 vs player4 bullets

                for (int i = 0; i <= noBullets - 1; i++)
                {
                    pBulletCollide = collision.pBulletsCollide(ammo, Player3, play3.position, Bullet4List[0].AmmoModelPosition, Content);
                    if (pBulletCollide == true)
                    {
                        spawntimer3 = 0;
                        #region Remove bullets
                        bulletCollide = false;
                        Bullet4List[0].AmmoModelPosition = new Vector3(5000, 5000f, 0.0f);
                        Bullet4List[0].AmmoFlying = false;
                        #endregion

                        Random x = new Random();
                        Random y = new Random();
                        play3.position.X = x.Next(-2000, 2000);
                        play3.position.Y = y.Next(-2000, 2000);

                        collide = false;
                        play3.Lives -= 1;

                        if (play3.Lives == 0)
                        {
                            p3dead = true;
                        }
                    }
                }

                #endregion
            }
            #endregion
            #endregion
        }
Esempio n. 4
0
        //Break up Asteroids
        private void SpawnAsteroids(Model passedModel, Vector3 position)
        {
            #region spawn 2 asteroid2
            if (passedModel == Asteroid1)
            {
                asteroidsonscreen += 2;
                int A2cnt = 0;
                for (int i = 0; i <= NumAsteroid2 - 1; i++)
                {
                    if (asteroid2List[i].isAlive == false)
                    {
                        asteroid2List[i] = new Asteroid(Asteroid2, position, 0.005f, true, 3);
                        A2cnt++;
                        if (A2cnt == 2)
                            break;
                    }
                }
            }
            #endregion

            #region Spawn 2 asteroid3
            if (passedModel == Asteroid2)
            {
                asteroidsonscreen += 2;
                int A3cnt = 0;
                for (int i = 0; i <= NumAsteroid3 - 1; i++)
                {

                    if (asteroid3List[i].isAlive == false)
                    {
                        asteroid3List[i] = new Asteroid(Asteroid3, position, 0.005f, true, 1);
                        A3cnt++;
                        if (A3cnt == 2)
                            break;

                    }
                }
            }
            #endregion
        }
Esempio n. 5
0
        public override void LoadContent()
        {
            if (Content == null)
                Content = new ContentManager(ScreenManager.Game.Services, "Content");

            #region loaded content

            myModel = Content.Load<Model>("Model\\fighter");
            Player2 = Content.Load<Model>("Model\\Player2");
            Player3 = Content.Load<Model>("Model\\Player3");
            Player4 = Content.Load<Model>("Model\\player4");

            Asteroid1 = Content.Load<Model>("Model\\Asteroid1");
            Asteroid2 = Content.Load<Model>("Model\\Asteroid2");
            Asteroid3 = Content.Load<Model>("Model\\Asteroid3");
            globe = Content.Load<Model>("Model\\globe");

            Explosion = Content.Load<SoundEffect>("Audio\\explosion3");

            dataScreen = Content.Load<Texture2D>("Images\\DataScreen");
            BackGround = Content.Load<Texture2D>("Images\\background");
            panel = Content.Load<Texture2D>("Images\\panel");
            panel2 = Content.Load<Texture2D>("Images\\panel2");
            hypButton = Content.Load<Texture2D>("Images\\p1hyp");
            hypButton2 = Content.Load<Texture2D>("Images\\p2hypclk");

            ammo = Content.Load<Model>("Model\\ammo");
            Engine = Content.Load<SoundEffect>("Audio\\engine_3");
            WeaponFire = Content.Load<SoundEffect>("Audio\\pdp1_fire");
            defaultFont = Content.Load<SpriteFont>("Fonts\\defaultFont");
            HyperSpace = Content.Load<SoundEffect>("Audio\\hax2_fire_alt");

            play = new Player(myModel, Player1Start, 0.0f, 10);
            play2 = new Player2(Player2, Player2Start, 0.0f, 10);
            play3 = new Player3(Player3, Player3Start, 0.0f, 10);
            play4 = new Player4(Player4, Player4Start, 0.0f, 10);

            Projectile bullet = new Projectile(ammo, Initial, 0.0f, Initial, false, Initial);
            BulletList = new Projectile[noBullets];
            Bullet2List = new Projectile[noBullets];
            Bullet3List = new Projectile[noBullets];
            Bullet4List = new Projectile[noBullets];

            #endregion

            #region Graphic Device and screen elements
            screenWidth = ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth;
            screenHeight = ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight;
            aspectRatio = ScreenManager.GraphicsDevice.Viewport.AspectRatio;
            #endregion

            #region initialise Asteroids
            AP1.X = 0;
            AP1.Y = 0;

            AP2.X = -2500;
            AP2.Y = -2000;

            AP3.X = -1500;
            AP3.Y = -1500;

            AP4.X = -300;
            AP4.Y = 1500;

            asteroid1List[0] = new Asteroid(Asteroid1, AP1, 0.005f, true, 5);
            asteroid1List[1] = new Asteroid(Asteroid1, AP2, 1.5f, true, 5);

            asteroid3List[0] = new Asteroid(Asteroid3, AP3, 0.005f, true, 1);
            asteroid3List[1] = new Asteroid(Asteroid3, AP4, 0.5f, true, 1);
            asteroid3List[2] = new Asteroid(Asteroid3, new Vector3(2500, 1900, 0), 1.25f, true, 1);
            asteroid3List[3] = new Asteroid(Asteroid3, new Vector3(300, 2500, 0), 2.0f, true, 1);
            asteroid3List[4] = new Asteroid(Asteroid3, new Vector3(-2500, 1500, 0), 2.5f, true, 1);
            asteroid3List[5] = new Asteroid(Asteroid3, new Vector3(-500, 200, 0), 3.0f, true, 1);
            asteroid3List[6] = new Asteroid(Asteroid3, new Vector3(-1500, 2000, 0), 3.5f, true, 1);
            asteroid3List[7] = new Asteroid(Asteroid3, new Vector3(1500, -2500, 0), 4.0f, true, 1);

            for (int i = 0; i < NumAsteroid2; i++)
                asteroid2List[i] = new Asteroid(Asteroid2, new Vector3(4000, 4000, 0), 0.005f, false, 3);

            for (int i = 8; i < NumAsteroid3; i++)
                asteroid3List[i] = new Asteroid(Asteroid3, new Vector3(4000, 4000, 0), 0.005f, false, 1);

            #endregion

            #region initialise bullet list
            for (int i = 0; i < noBullets; i++)
            {
                BulletList[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
            }
            #endregion

            #region initialise bullet 2 list
            for (int i = 0; i < noBullets; i++)
            {
                Bullet2List[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
            }
            #endregion

            #region initialise bullet 3 list
            for (int i = 0; i < noBullets; i++)
            {
                Bullet3List[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
            }
            #endregion

            #region initialise bullet 4 list
            for (int i = 0; i < noBullets; i++)
            {
                Bullet4List[i] = new Projectile(ammo, new Vector3(5000, 5000, 0), 0.0f, Initial, false, Initial);
            }
            #endregion
        }