Ejemplo n.º 1
0
 // constructor for the test class
 public Player_Test()
 {
     //create a new player instance and invoke constructor
     testplay = new Player();
 }
Ejemplo n.º 2
0
        // Constructor
        public ActionScreen(Game game, SpriteBatch spriteBatch, Texture2D background, ContentManager content)
            : base(game, spriteBatch)
        {
            gameBackgroundImage = background; // give an image to the background
            backgroundFileWidth = gameBackgroundImage.Width; // give the width to the background
            backgroundFileHeight = gameBackgroundImage.Height; // give the height to the background

            player = new Player(content.Load<Texture2D>(@"Textures\PlayerShip")); // initialize player

            // fill EnemiesType1 array with enemies of type 1
            for (int i = 0; i < iTotalMaxEnemies; i++)
            {
                EnemiesType1[i] = new Enemy1(content.Load<Texture2D>(@"Textures\TurtleRobot"), 0, 0, 73, 45, 1);
            }

            // fill EnemiesType2 array with enemies of type 2
            for (int i = 0; i < iTotalMaxEnemies2; i++)
            {
                EnemiesType2[i] = new Enemy2(content.Load<Texture2D>(@"Textures\spacerabbit"), 0, 0, 46, 75, 1);
                EnemiesType2[i].InitializeBullets(content.Load<Texture2D>(@"Textures\PlayerAmmo"));
            }

            boss = new Boss(content.Load<Texture2D>(@"Textures\donald2"), 0, 0, 150, 104, 1); // Create boss
            boss.InitializeBullets(content.Load<Texture2D>(@"Textures\PlayerAmmo")); // 4/27 innitialize sprites for the boss's bullets

            gameHudImage = content.Load<Texture2D>(@"Textures\hud"); // load "HUD"
            spriteFont = content.Load<SpriteFont>(@"Fonts\Pericles"); // load font

            //initialize ammo
            bolts[0] = new Ammo(content.Load<Texture2D>(@"Textures\PlayerAmmo"));

            for (int x = 1; x < iMaxBolts; x++)
                bolts[x] = new Ammo(content.Load<Texture2D>(@"Textures\PlayerAmmo"));

            // load content for sound effects
            laserFire = content.Load<SoundEffect>(@"Audio\Laser");
            laserFire2 = content.Load<SoundEffect>(@"Audio\Laser2");
            enemy1Destroyed = content.Load<SoundEffect>(@"Audio\Enemy1Explosion");
            playerDestroyed = content.Load<SoundEffect>(@"Audio\ShipExplosion");
            sorry = content.Load<SoundEffect>(@"Audio\sorryLouder");
            maroon = content.Load<SoundEffect>(@"Audio\maroonLouder");
            ultraMaroon = content.Load<SoundEffect>(@"Audio\ultraMaroonLouder");

            youFired = content.Load<SoundEffect>(@"Audio\YouFiredLoud");
            youFiredSoundInstance = youFired.CreateInstance();
            youFiredSoundInstance.Volume = 1;
            youFiredSoundInstance.Pitch = 0.1f;

            alien = content.Load<SoundEffect>(@"Audio\Alien");
            alienSoundInstance = alien.CreateInstance();
            alienSoundInstance.Volume = 1;

            deal = content.Load<SoundEffect>(@"Audio\deal");
            dealSoundInstance = deal.CreateInstance();
            dealSoundInstance.Volume = 1;

            youFiredSoundDuration = alien.Duration;

            maroonSoundInstance = maroon.CreateInstance(); // Create maroon sound instance
            ultraMaroonSoundInstance = ultraMaroon.CreateInstance(); // create ultra maroon sound instance
            sorrySoundInstance = sorry.CreateInstance(); // create sorry sound instance

            maroonSoundDuration = maroon.Duration; // get duration of maroon effect

            maroonSoundInstance.Volume = 1; // set volume 0 - 1
            ultraMaroonSoundInstance.Volume = 1; // set volume 0 - 1
        }