Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            LoadGameLevel(1);

            // TODO: use this.Content to load your game content here
            sound_explosion = this.Content.Load <SoundEffect>("sound_explosion");
            sound_laser     = this.Content.Load <SoundEffect>("sound_laser");
            song            = this.Content.Load <Song>("theme_v2");
            gameOverFont    = this.Content.Load <SpriteFont>("GameOverFont");
            scoreFont       = this.Content.Load <SpriteFont>("ScoreFont");

            Texture2D player_tex      = this.Content.Load <Texture2D>("fighter");
            Texture2D energyShot_tex  = this.Content.Load <Texture2D>("energy_shot");
            Texture2D fighter_sil_tex = this.Content.Load <Texture2D>("fighter_silhouette");

            //create HUD
            Element playerLife1 = new Element(fighter_sil_tex, (5 * GameValues.Instance.SCALEX), 5);
            Element playerLife2 = new Element(fighter_sil_tex, playerLife1.m_pos.X + fighter_sil_tex.Width + (5 * GameValues.Instance.SCALEX), 5);
            Element playerLife3 = new Element(fighter_sil_tex, playerLife2.m_pos.X + fighter_sil_tex.Width + (5 * GameValues.Instance.SCALEX), 5);

            PlayerLifes.Add(playerLife1);
            PlayerLifes.Add(playerLife2);
            PlayerLifes.Add(playerLife3);

            //create player elements
            Shot playerShot = new Shot(energyShot_tex, 0, 30);

            InitPlayerWeapons(playerShot);
            Player = new Player(player_tex, PlayerWeapons, WIDTH / 4, HEIGHT / 2);

            //star field
            List <Texture2D> starField_textures = new List <Texture2D>();

            starField_textures.Add(Content.Load <Texture2D>("star_dot"));
            starField = new StarField(starField_textures, new Vector2(500, 300), SCALE);

            MediaPlayer.Play(song);
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            LoadGameLevel(1);

            // TODO: use this.Content to load your game content here
            sound_explosion = this.Content.Load<SoundEffect>("sound_explosion");
            sound_laser = this.Content.Load<SoundEffect>("sound_laser");
            song = this.Content.Load<Song>("theme_v2");
            gameOverFont = this.Content.Load<SpriteFont>("GameOverFont");
            scoreFont = this.Content.Load<SpriteFont>("ScoreFont");

            Texture2D player_tex = this.Content.Load<Texture2D>("fighter");
            Texture2D energyShot_tex = this.Content.Load<Texture2D>("energy_shot");
            Texture2D fighter_sil_tex = this.Content.Load<Texture2D>("fighter_silhouette");

            //create HUD
            Element playerLife1 = new Element(fighter_sil_tex, (5 * GameValues.Instance.SCALEX), 5);
            Element playerLife2 = new Element(fighter_sil_tex, playerLife1.m_pos.X + fighter_sil_tex.Width + (5 * GameValues.Instance.SCALEX), 5);
            Element playerLife3 = new Element(fighter_sil_tex, playerLife2.m_pos.X + fighter_sil_tex.Width + (5 * GameValues.Instance.SCALEX), 5);
            PlayerLifes.Add(playerLife1);
            PlayerLifes.Add(playerLife2);
            PlayerLifes.Add(playerLife3);

            //create player elements
            Shot playerShot = new Shot(energyShot_tex, 0, 30);
            InitPlayerWeapons(playerShot);
            Player = new Player(player_tex, PlayerWeapons, WIDTH / 4, HEIGHT / 2);

            //star field
            List<Texture2D> starField_textures = new List<Texture2D>();
            starField_textures.Add(Content.Load<Texture2D>("star_dot"));
            starField = new StarField(starField_textures, new Vector2(500, 300), SCALE);

            MediaPlayer.Play(song);
        }