コード例 #1
0
ファイル: Level2.cs プロジェクト: kolpime/Asteroids
        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
        }
コード例 #2
0
ファイル: FourPlayer.cs プロジェクト: kolpime/Asteroids
        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
        }