コード例 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs");
            waveBank    = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");

            bgm          = Content.Load <Song>("irisu_05");
            gameOver_sfx = Content.Load <Song>("irisu_gos1");

            bg1_texture = Content.Load <Texture2D>("bg1");
            bg2_texture = Content.Load <Texture2D>("bg2");
            bg3_texture = Content.Load <Texture2D>("bg3");

            asteroid_texture  = Content.Load <Texture2D>("asteroid");
            player_texture    = Content.Load <Texture2D>("Ship");
            bullet_texture    = Content.Load <Texture2D>("Bullet");
            gameOver_texture  = Content.Load <Texture2D>("GameOver1");
            explosion_texture = Content.Load <Texture2D>("explosion");
            player_explode    = Content.Load <Texture2D>("player_explosion");
            powerup_texture   = Content.Load <Texture2D>("powerups");
            font1             = Content.Load <SpriteFont>("font1");

            player  = new Player(player_texture, playerStartPos, Vector2.Zero, playerAcc);
            powerup = new Powerup(powerup_texture, Vector2.Zero, Vector2.Zero, new Rectangle(0, 0, 0, 0), 0);

            bg1 = new bg(bg1_texture, new Rectangle(0, 0, bg1_texture.Width, bg1_texture.Height), new Rectangle(0, -bg1_texture.Height, bg1_texture.Width, bg1_texture.Height), 1f, 2);
            bg2 = new bg(bg2_texture, new Rectangle(0, 0, bg2_texture.Width, bg2_texture.Height), new Rectangle(0, -bg2_texture.Height, bg2_texture.Width, bg2_texture.Height), 0.3f, 3);
            bg3 = new bg(bg3_texture, new Rectangle(0, 0, bg3_texture.Width, bg3_texture.Height), new Rectangle(0, -bg3_texture.Height, bg3_texture.Width, bg3_texture.Height), 0.5f, 4);

            asteroids = new List <Asteroid>();
            bullets   = new List <Bullet>();
            rand      = new Random();

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = 0.1f;
            MediaPlayer.Play(bgm);
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: Pandamonium-san/asteroids
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            
            audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
           
            bgm = Content.Load<Song>("irisu_05");
            gameOver_sfx = Content.Load<Song>("irisu_gos1");

            bg1_texture = Content.Load<Texture2D>("bg1");
            bg2_texture = Content.Load<Texture2D>("bg2");
            bg3_texture = Content.Load<Texture2D>("bg3");

            asteroid_texture = Content.Load<Texture2D>("asteroid");
            player_texture = Content.Load<Texture2D>("Ship");
            bullet_texture = Content.Load<Texture2D>("Bullet");
            gameOver_texture = Content.Load<Texture2D>("GameOver1");
            explosion_texture = Content.Load<Texture2D>("explosion");
            player_explode = Content.Load<Texture2D>("player_explosion");
            powerup_texture = Content.Load<Texture2D>("powerups");
            font1 = Content.Load<SpriteFont>("font1");

            player = new Player(player_texture, playerStartPos, Vector2.Zero, playerAcc);
            powerup = new Powerup(powerup_texture, Vector2.Zero, Vector2.Zero, new Rectangle(0,0,0,0), 0);

            bg1 = new bg(bg1_texture, new Rectangle(0, 0, bg1_texture.Width, bg1_texture.Height), new Rectangle(0, -bg1_texture.Height, bg1_texture.Width, bg1_texture.Height), 1f, 2);
            bg2 = new bg(bg2_texture, new Rectangle(0, 0, bg2_texture.Width, bg2_texture.Height), new Rectangle(0, -bg2_texture.Height, bg2_texture.Width, bg2_texture.Height), 0.3f, 3);
            bg3 = new bg(bg3_texture, new Rectangle(0, 0, bg3_texture.Width, bg3_texture.Height), new Rectangle(0, -bg3_texture.Height, bg3_texture.Width, bg3_texture.Height), 0.5f, 4);

            asteroids = new List<Asteroid>();
            bullets = new List<Bullet>();
            rand = new Random();

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.1f;
            MediaPlayer.Play(bgm);
        }