예제 #1
0
 public void Initialize(Animation animation, Vector2 position)
 {
     this.playerAnimation = animation;
         this.Position = position;
         this.Active = true;
         this.Health = 100;
 }
예제 #2
0
 public void Initialize(Animation animation, Vector2 position)
 {
     PlayerAnimation = animation;
     Position = position;
     Active = true;
     Health = 100;
 }
예제 #3
0
 public void Initialize(Animation animation, Vector2 Initializedposition)
 {
     PlayerAnimation = animation;
     Position = Initializedposition;
     Active = true;
     Health = 1;//GUILE THEME!
     Weapon = 1;
 }
예제 #4
0
 public override void Initialize(Animation animation, Vector2 startPos)
 {
     health = 10;
     damage = 10;
     speed = 120f;
     pointValue = 100;
     base.Initialize(animation, startPos);
 }
예제 #5
0
 // Ініціалізація
 public void Initialize(Animation animation, Vector2 position)
 {
     PlayerAnimation = animation;
     // Стартова позиція
     Position = position;
     // Стан - активний
     Active = true;
     // Здоров'я 100
     Health = 100;
 }
예제 #6
0
 public void Initialize(Animation animation, Vector2 position)
 {
     EnemyAnimation = animation;
     Position = position;
     Active = true;
     Health = 10;
     Damage = 10;
     enemyMoveSpeed = 6f;
     Value = 100;
 }
예제 #7
0
        public void Initialize(Animation animation, Vector2 position)
        {
            PlayerAnimation = animation;

            //Set starting position of player to argument position
            Position = position;

            //Player is active
            Active = true;
            //Has 100 health
            Health = 100;
        }
예제 #8
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);

            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);
            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);
            // TODO: use this.Content to load your game content here
        }
예제 #9
0
파일: player.cs 프로젝트: urvaius/shooter
        public void Initialize(Animation animation, Vector2 position)
        {
            PlayerAnimation = animation;

            // Set the starting position of the player around the middle of thescreen and to the back
            Position = position;

            // Set the player to be active
            Active = true;

            // Set the player health
            Health = 100;
        }
예제 #10
0
        public void Initialize(Animation playerAnimation, Vector2 position)
        {
            //Assign the texture to the object
               this.playerAnimation = playerAnimation;

            //Set The Starting position of the player around
            playerPosition = position;

            //Set The player to be active
            isActive = true;

            //Set the player's HP
            playerHitpoints = 100;
        }
예제 #11
0
        public override void Initialize(Animation animation, Vector2 position, float df)
        {
            // Load the power up texture
            powerUpAnimation = animation;

            // Set the position of the power up
            powerUpPosition = position;

            // We initialize the power up to be active so it will be update in the game
            powerUpActive = true;

            // Set how fast the power up moves
            powerUpMoveSpeedX = 4f * df;
            powerUpMoveSpeedY = 2f * df;
        }
예제 #12
0
        // *** have to pass in Texture2D texture if you want regular texture
        public void Initialize(Animation animation, Vector2 position)
        {
            //PlayerTexture = texture; *** used for just plain texture

            PlayerAnimation = animation;

            // Set the starting position of the player around the middle of the screen and to the back
            Position = position;

            // Set the player to be active
            Active = true;

            // Set the player health
            Health = 100;
        }
예제 #13
0
        public void Initialize(Animation animation, Vector2 position)
        {
            // Load the enemy ship texture
            EnemyAnimation = animation;

            // Set the position of the enemy
            Position = position;

            // We initialize the enemy to be active so it will be update in the game
            Active = true;

            // Set how fast the enemy moves
            enemyMoveSpeed = 1.3f;

            random = new Random();
        }
예제 #14
0
        public void Initialize(Animation animation, Vector2 position)
        {
            PlayerAnimation = animation;

            //Stop the player animation rotating to much
            //PlayerAnimation.Rotation = MathHelper.Clamp(PlayerAnimation.Rotation, -0.4f, 0.4f);

            // Set the starting position of the player around the middle of the screen and to the back
            Position = position;

            random = new Random();

            // Set the player to be active
            Active = true;

            // Set the player health
            Health = 100;
        }
예제 #15
0
 public void Initialize(Animation animation, Vector2 position, int health, float moveSpeed)
 {
     // Завантаження текстури
     EnemyAnimation = animation;
     // Стартова позиція
     Position = position;
     // Стан - активний
     Active = true;
     // Здоров'я
     Health = health;
     // Пошкодження
     Damage = 10;
     // Швидкість
     enemyMoveSpeed = moveSpeed;
     // Кількість очок
     Value = 100;
     // Швидкість руху по вертикалі
     Random rnd = new Random();
     enemyMoveSpeedY = (float)(rnd.Next(-2, 2) * 0.4);
 }
예제 #16
0
        public void Initialize(Animation animation, Vector2 position)
        {
            // Load the Boss ship texture
            BossAnimation = animation;

            // Set the position of the Boss
            Position = position;

            // We initialize the Boss to be active so it will be update in the game
            Active = true;

            // Set the health of the Boss
            Health = 10;

            // Set the amount of damage the Boss can do
            Damage = 10;

            // Set how fast the Boss moves
            BossMoveSpeed = 6f;

            // Set the score value of the Boss
            Value = 100;
        }
예제 #17
0
        public void Initalize(Animation animation, Vector2 position)
        {
            // Load the enemy ship texture
            EnemyAnimation = animation;

            // Set the position of the enemy
            Position = position;

            // We initalize the enemy to be active so it will be updated in the game
            Active = true;

            // Set the health of the enemy
            Health = 10;

            // Set the amount of damage the enemy can do
            Damage = 10;

            // Set how fast the enemy moves
            enemyMoveSpeed = 6f;

            // Set the score value of the enemy
            Value = 100;
        }
예제 #18
0
        //Ignore error about needing 'new'
        public override void Initialize(Animation animation, Vector2 position, float df)
        {
            // Load the enemy ship texture
            EnemyAnimation = animation;

            // Set the position of the enemy
            Position = position;

            // We initialize the enemy to be active so it will be update in the game
            Active = true;

            // Set the health of the enemy
            Health = 50 * df;

            // Set the amount of damage the enemy can do
            Damage = 30 * df;

            // Set how fast the enemy moves
            enemyMoveSpeedX = 1f * df;

            // Set the score value of the enemy
            Value = 500 * df;
        }
예제 #19
0
        //==============================================================================================================================
        private void AddHeavyEnemy()
        {
            // Create the animation object
            Animation heavyEnemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            heavyEnemyAnimation.Initialize(heavyEnemyTexture, Vector2.Zero, heavyEnemyTexture.Width, heavyEnemyTexture.Height, 1, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + heavyEnemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            HeavyEnemy heavyEnemy = new HeavyEnemy();

            // Initialize the enemy
            heavyEnemy.Initialize(heavyEnemyAnimation, position, difficultyFactor);

            // Add the heavyEnemy to the active enemies list
            heavyEnemies.Add(heavyEnemy);
        }
예제 #20
0
 private void AddExplosion(Vector2 position)
 {
     Animation explosion = new Animation();
     explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false);
     explosions.Add(explosion);
     if (Game1.WithSound)
     {
         // Play the explosion sound
         explosionSound.Play();
     }
 }
예제 #21
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the player resources

            Animation playerAnimation = new Animation();
            Animation player2Animation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            Texture2D player2Texture = Content.Load<Texture2D>("shipAnimation2");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            enemyTexture = Content.Load<Texture2D>("mineAnimation");

            player2Animation.Initialize(player2Texture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            Vector2 player2Position = new Vector2(GraphicsDevice.Viewport.Width + (50), GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);
            player2.Initialize(player2Animation,player2Position);
            // Load the parallaxing background
            bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2);

            mainBackground = Content.Load<Texture2D>("mainbackground");
            spriteBatch = new SpriteBatch(GraphicsDevice);

            projectileTexture = Content.Load<Texture2D>("laser");

            explosionTexture = Content.Load<Texture2D>("explosion");

            // Load the music
            gameplayMusic = Content.Load<Song>("sound/gameMusic");

            // Load the laser and explosion sound effect
            laserSound = Content.Load<SoundEffect>("sound/laserFire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");

            font = Content.Load<SpriteFont>("gameFont");

            // Start the music right away
            PlayMusic(gameplayMusic);

            // TODO: use this.Content to load your game content here
        }
예제 #22
0
        public override void LoadContent()
        {
            //////******************* INIT

            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List<Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.25f);

            explosions = new List<Animation>();

            score = 0;

            //////////******************* LOAD
            if (Content == null)
                Content = new ContentManager(ScreenManager.Game.Services, "Content");

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = ScreenManager.SpriteBatch;

            //player.Initialize(Content.Load<Texture2D>("player"), playerPosition);
            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            // Load the parallaxing background
            bgLayer1.Initialize(Content, "bgLayer1", ScreenManager.GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bgLayer2", ScreenManager.GraphicsDevice.Viewport.Width, -2);

            mainBackground = Content.Load<Texture2D>("mainbackground");
            enemyTexture = Content.Load<Texture2D>("mineAnimation");
            projectileTexture = Content.Load<Texture2D>("laser");
            explosionTexture = Content.Load<Texture2D>("explosion");
            // Load the score font
            font = Content.Load<SpriteFont>("gameFont");

            // Load the music
            gameplayMusic = Content.Load<Song>("sound/gameMusic");

            // Load the laser and explosion sound effect
            laserSound = Content.Load<SoundEffect>("sound/laserFire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");
            SoundEffect.MasterVolume = (float)Game1.VolumeSound / 100;

            // Start the music right away
            PlayMusic(gameplayMusic);
        }
예제 #23
0
        private void AddEnemy()
        {
            // Create the animation object
            Animation enemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, ScreenManager.GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            Enemy enemy = new Enemy();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);

            // Add the enemy to the active enemies list
            enemies.Add(enemy);
        }
예제 #24
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            LoadPlayer();

            bgLayer1.Initialize(Content, "Graphics\\bgLayer1", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 1);
            bgLayer2.Initialize(Content, "Graphics\\bgLayer2", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 2);
            mainBackground = Content.Load <Texture2D>("Graphics\\Starbasesnow");

            enemyTexture = Content.Load <Texture2D>("Graphics\\enemyAnimation");

            shootingEnemy.LoadContent("Graphics\\shootingEnemy", Content);
            shootingEnemyAnimation = new Animation();
            shootingEnemyAnimation.Initialize(shootingEnemy.Texture, Vector2.Zero, 300, 300, 1, 30, Color.White, 0.2f, true, 0, Vector2.Zero,
                                              SpriteEffects.None, 0);
            enemyCount = 0;

            laserTexture      = Content.Load <Texture2D>("Graphics\\laser");
            enemyLaserTexture = Content.Load <Texture2D>("Graphics\\enemyLaser");

            healer.LoadContent("Graphics\\healer", Content);
            healerAnimation = new Animation();
            healerAnimation.Initialize(healer.Texture, Vector2.Zero, 155, 114, 3, 30, Color.White, 0.37f, true, 0, Vector2.Zero,
                                       SpriteEffects.None, 0);

            bomb.LoadContent("Graphics\\galaxy", Content);
            bombAnimation = new Animation();
            bombAnimation.Initialize(bomb.Texture, Vector2.Zero, 256, 256, 15, 30, Color.White, 0.42f, true, 0, Vector2.Zero,
                                     SpriteEffects.None, 0);

            for (int i = 0; i < asteroids.Length; i++)
            {
                asteroids[i]          = new Asteroids();
                asteroidsAnimation[i] = new Animation();
            }

            asteroids[0].LoadContent("Graphics\\aestroid1", Content);
            asteroidsAnimation[0].Initialize(asteroids[0].Texture, Vector2.Zero, 447, 390, 1, 30, Color.White, 0.14f, true, 0,
                                             new Vector2(asteroids[0].Texture.Width / 2, asteroids[0].Texture.Height / 2),
                                             SpriteEffects.None, 0);

            asteroids[1].LoadContent("Graphics\\aestroid2", Content);
            asteroidsAnimation[1].Initialize(asteroids[1].Texture, Vector2.Zero, 424, 349, 1, 30, Color.White, 0.13f, true, 0,
                                             new Vector2(asteroids[1].Texture.Width / 2, asteroids[1].Texture.Height / 2),
                                             SpriteEffects.None, 0);

            asteroids[2].LoadContent("Graphics\\aestroid3", Content);
            asteroidsAnimation[2].Initialize(asteroids[2].Texture, Vector2.Zero, 394, 323, 1, 30, Color.White, 0.14f, true, 0,
                                             new Vector2(asteroids[2].Texture.Width / 2, asteroids[2].Texture.Height / 2),
                                             SpriteEffects.None, 0);


            enemyExplosionTexture = Content.Load <Texture2D>("Graphics\\explosion");
            allyExplosionTexture  = Content.Load <Texture2D>("Graphics\\blueExplosion");
            brownAsteroidTexture  = Content.Load <Texture2D>("Graphics\\brownExplosion");
            greyAsteroidTexture   = Content.Load <Texture2D>("Graphics\\greyExplosion");

            playButton = new Button("Graphics\\playButton", new Vector2((GraphicsDevice.Viewport.TitleSafeArea.Width / 2), 250), Content,
                                    0.9f, 1f);
            exitButton = new Button("Graphics\\exitButton", new Vector2((GraphicsDevice.Viewport.TitleSafeArea.Width / 2), 390), Content,
                                    0.9f, 1f);
            healthBar = new HealthBar("Graphics\\healthBar2", Content, 262, 41, 0.8f, new Vector2(458, 5));

            playButtonSound             = new Sound(Content, "Sounds\\button", 0.3f, false);
            exitButtonSound             = new Sound(Content, "Sounds\\button", 0.3f, false);
            playerLaserSound            = new Sound(Content, "Sounds\\laser", 0.16f, false);
            enemyLaserSound             = new Sound(Content, "Sounds\\enemyLaser", 0.17f, false);
            asteroidExplosionSound      = new Sound(Content, "Sounds\\asteroidExplosion", 0.17f, false);
            shootingEnemyExplosionSound = new Sound(Content, "Sounds\\asteroidExplosion", 0.17f, false);
            bigBombSound         = new Sound(Content, "Sounds\\bigBomb", 0.25f, false);
            healerCollisionSound = new Sound(Content, "Sounds\\health", 0.25f, false);
            playerExplosionSound = new Sound(Content, "Sounds\\playerExplosion", 0.3f, false);
            injuredPlayerSound   = new Sound(Content, "Sounds\\injuredPlayer", 0.27f, false);

            gameMusic = new GameMusic(Content, "Sounds\\gameMusic", 0.35f, true);

            font = Content.Load <SpriteFont>("Text");
        }
예제 #25
0
파일: Game1.cs 프로젝트: urvaius/shooter
        /// <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);

            m_effect = Content.Load<Effect>("Effects/standard");

            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            // Load the parallaxing background
            bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2);

            mainBackground = Content.Load<Texture2D>("mainbackground");

            enemyTexture = Content.Load<Texture2D>("mineAnimation");
            //load the projectile graphic
            projectileTexture = Content.Load<Texture2D>("laser");
            explosionTexture = Content.Load<Texture2D>("explosion");
            //loud music
            gameplayMusic = Content.Load<Song>("sound/gameMusic");
            //load the laser and explosion sound effect
            laserSound = Content.Load<SoundEffect>("sound/laserfire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");
            // start the music right away
            PlayMusic(gameplayMusic);
            //load the score font
            font = Content.Load<SpriteFont>("gameFont");
        }
예제 #26
0
        //==============================================================================================================================
        private void AddRapidFirePowerUp()
        {
            // Create the animation object
            Animation rapidFirePowerUpAnimation = new Animation();

            // Initialize the animation with the correct animation information
            rapidFirePowerUpAnimation.Initialize(rapidFirePowerUpTexture, Vector2.Zero, rapidFirePowerUpTexture.Width, rapidFirePowerUpTexture.Height, 1, 30, Color.White, 1f, true);

            // Randomly generate the position of the rapid fire power up
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + rapidFirePowerUpTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            // Create a power up
            RapidFirePowerUp rapidFirePowerUp = new RapidFirePowerUp();

            // Initialize the rapid fire power up
            rapidFirePowerUp.Initialize(rapidFirePowerUpAnimation, position, difficultyFactor);

            // Add the missile power up to the active power up list
            rapidFirePowerUps.Add(rapidFirePowerUp);
        }
예제 #27
0
        private void AddEnemy()
        {
            Animation enemyAnimation = new Animation();
            enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 47, 61, 8, 30, Color.White, 1f, true);
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            Enemy enemy = new Enemy();
            enemy.Initialize(enemyAnimation, position);
            enemies.Add(enemy);
        }
예제 #28
0
        //=============================================================================================================================================
        private void AddDiagonal()
        {
            // Create the animation object
            Animation DiagonalAnimation = new Animation();

            // Initialize the animation with the correct animation information
            DiagonalAnimation.Initialize(diagonalTexture, Vector2.Zero, diagonalTexture.Width, diagonalTexture.Height, 1, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + diagonalTexture.Width / 2, random.Next(100, GraphicsDevice.Viewport.Height - 100));

            // Create an enemy
            Diagonal diagonal = new Diagonal();

            // Initialize the enemy
            diagonal.Initialize(DiagonalAnimation, position, difficultyFactor);

            // Add the digonal to the active enemies list
            diagonals.Add(diagonal);
        }
예제 #29
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);

            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
               + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            bgLayer1.Initialize(Content, "bgLayer1", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bgLayer2", GraphicsDevice.Viewport.Width, -2);

            enemyTexture = Content.Load<Texture2D>("mineAnimation");
            projectileTexture = Content.Load<Texture2D>("laser");
            explosionTexture = Content.Load<Texture2D>("explosion");
            gameplayMusic = Content.Load<Song>("sound/gameMusic");
            laserSound = Content.Load<SoundEffect>("sound/laserFire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");
            PlayMusic(gameplayMusic);
            font = Content.Load<SpriteFont>("gameFont");
            mainBackground = Content.Load<Texture2D>("mainbackground");
            // TODO: use this.Content to load your game content here
        }
예제 #30
0
        //============================================================================================================================
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 79, 58, 1, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            // Load the parallaxing background
            bgLayer1.Initialize(Content, "bglayer1", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bglayer2", GraphicsDevice.Viewport.Width, -2);

            enemyTexture = Content.Load<Texture2D>("ship4");
            heavyEnemyTexture = Content.Load<Texture2D>("bigShip");
            diagonalTexture = Content.Load<Texture2D>("diagonal");
            playerCutsceneTexture = Content.Load<Texture2D>("player");
            transportTexture = Content.Load<Texture2D>("Ship5");
            healthPowerUpTexture = Content.Load<Texture2D>("HealthPowerUp");
            missilePowerUpTexture = Content.Load<Texture2D>("MissilePowerUp");
            rapidFirePowerUpTexture = Content.Load<Texture2D>("rapidFirePowerUp");

            projectileTexture = Content.Load<Texture2D>("laser1");
            missileTexture = Content.Load<Texture2D>("rocket");

            explosionTexture = Content.Load<Texture2D>("explosion");

            // Load the music
            gameplayMusic = Content.Load<Song>("sound/gameMusic");
            cryingSound = Content.Load<Song>("sound/crying_loud_male");

            // Load the laser and explosion sound effect
            laserSound = Content.Load<SoundEffect>("sound/laserFire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");
            explosionSound2 = Content.Load<SoundEffect>("sound/explosion-04");

            // Start the music right away
            PlayMusic(gameplayMusic);

            // Load the score font
            font = Content.Load<SpriteFont>("gameFont");

            mainBackground = Content.Load<Texture2D>("mainbackground");

            mainMenu = Content.Load<Texture2D>("mainMenu");
            endMenu = Content.Load<Texture2D>("endMenu");
        }
예제 #31
0
 private void AddExplosion(Vector2 position)
 {
     Animation explosion = new Animation();
     explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White,
     1f, false);
     explosions.Add(explosion);
 }
예제 #32
0
 public void Draw(SpriteBatch spriteBatch)
 {
     Animation.DrawWithRotation(spriteBatch, Angle);
 }