/// <summary>
        /// Creates a new brain boss
        /// </summary>
        /// <param name="id">The game id to assign to the new object</param>
        /// <param name="content">A ContentManager to load content from</param>
        /// <param name="position">A position on the screen</param>
        public BrainBoss(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.brainSpritesheet = content.Load<Texture2D>("Spritesheets/newsh5.shp.000000");
            this.psiOrbSpritesheet = content.Load<Texture2D>("Spritesheets/tyrian.shp.000000");

            this.brainSpriteBounds = new Rectangle(60, 143, 73, 80);
            this.psiOrbBounds = new Rectangle(121, 172, 21, 21);
            this.psiOrbOrigin = new Vector2(psiOrbBounds.Width / 2, psiOrbBounds.Height / 2);

            psiOrbOffset.X = brainSpriteBounds.Width / 2;
            psiOrbOffset.Y = brainSpriteBounds.Height / 2;

            this.position = position;

            centerOffset = new Vector2(brainSpriteBounds.Width / 2, brainSpriteBounds.Height / 2);

            psiEmitter = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossPsyEmitter, position + centerOffset) as BrainBossPsiEmitter;

            protection = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossProtection, position + centerOffset);
            //TODO: add protection organs for initial stage

             screenCenterX = ScrollingShooterGame.Game.GraphicsDevice.Viewport.Width / 2 - brainSpriteBounds.Width / 2;
             screenCenterY = ScrollingShooterGame.Game.GraphicsDevice.Viewport.Height / 2 - brainSpriteBounds.Height / 2;
        }
        /// <summary>
        /// Creates a new instance of an alien head
        /// </summary>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Dart ship in the game world</param>
        public AlienHead(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position = position;
            this.Score = 100;
            phase = AlienPhase.Wait;
            timer = 0;

            spritesheet = content.Load<Texture2D>("Spritesheets/newshn.shp.000000");

            spriteBounds[(int)AlienHeadPart.Face].X = 7;
            spriteBounds[(int)AlienHeadPart.Face].Y = 56;
            spriteBounds[(int)AlienHeadPart.Face].Width = 113;
            spriteBounds[(int)AlienHeadPart.Face].Height = 94;
            drawBounds[(int)AlienHeadPart.Face] = new Rectangle((int)position.X, (int)position.Y, spriteBounds[(int)AlienHeadPart.Face].Width, spriteBounds[(int)AlienHeadPart.Face].Height);

            spriteBounds[(int)AlienHeadPart.Forehead].X = 24;
            spriteBounds[(int)AlienHeadPart.Forehead].Y = 2;
            spriteBounds[(int)AlienHeadPart.Forehead].Width = 72;
            spriteBounds[(int)AlienHeadPart.Forehead].Height = 54;
            drawBounds[(int)AlienHeadPart.Forehead] = new Rectangle((int)position.X + 18, (int)(position.Y - spriteBounds[(int)AlienHeadPart.Forehead].Height), spriteBounds[(int)AlienHeadPart.Forehead].Width, spriteBounds[(int)AlienHeadPart.Forehead].Height);

            spriteBounds[(int)AlienHeadPart.FaceAnimation1].X = 0;
            spriteBounds[(int)AlienHeadPart.FaceAnimation1].Y = 168;
            spriteBounds[(int)AlienHeadPart.FaceAnimation1].Width = 48;
            spriteBounds[(int)AlienHeadPart.FaceAnimation1].Height = 56;

            spriteBounds[(int)AlienHeadPart.FaceAnimation2].X = 48;
            spriteBounds[(int)AlienHeadPart.FaceAnimation2].Y = 168;
            spriteBounds[(int)AlienHeadPart.FaceAnimation2].Width = 48;
            spriteBounds[(int)AlienHeadPart.FaceAnimation2].Height = 56;

            spriteBounds[(int)AlienHeadPart.FaceAnimation3].X = 96;
            spriteBounds[(int)AlienHeadPart.FaceAnimation3].Y = 168;
            spriteBounds[(int)AlienHeadPart.FaceAnimation3].Width = 48;
            spriteBounds[(int)AlienHeadPart.FaceAnimation3].Height = 56;

            spriteBounds[(int)AlienHeadPart.FaceAnimation4].X = 144;
            spriteBounds[(int)AlienHeadPart.FaceAnimation4].Y = 168;
            spriteBounds[(int)AlienHeadPart.FaceAnimation4].Width = 48;
            spriteBounds[(int)AlienHeadPart.FaceAnimation4].Height = 56;

            //bounds for all of the face animations
            drawBounds[(int)AlienHeadPart.FaceAnimation1] = new Rectangle((int)position.X + 41, (int)position.Y + 28, spriteBounds[(int)AlienHeadPart.FaceAnimation1].Width, spriteBounds[(int)AlienHeadPart.FaceAnimation1].Height);

               //populating the list for the animation sequence
            animationSequence = new List<AlienHeadAnimation>();
            animationSequence.Add(AlienHeadAnimation.Stage1);
            animationSequence.Add(AlienHeadAnimation.Stage2);
            animationSequence.Add(AlienHeadAnimation.Stage3);
            animationSequence.Add(AlienHeadAnimation.Stage4);

            frame = -1;

            //setting up the shield generators
            generator1 = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.ShieldGenerator, new Vector2(position.X + 70, position.Y + 100));
            generator2 = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.ShieldGenerator, new Vector2(position.X - 70, position.Y + 100));

            //set up the turrets
            turrets[0] = (AlienTurret)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.AlienTurret, new Vector2(position.X - 150, position.Y + 80));
            turrets[1] = (AlienTurret)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.AlienTurret, new Vector2(position.X - 100, position.Y + 20));
            turrets[2] = (AlienTurret)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.AlienTurret, new Vector2(position.X + 100, position.Y + 20));
            turrets[3] = (AlienTurret)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.AlienTurret, new Vector2(position.X + 150, position.Y + 80));

            //set up the claws
            ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.LeftClaw, new Vector2(0, 250));
            ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.RightClaw, new Vector2(0, 250));
        }
Example #3
0
        /// <summary>
        /// Updates the Lavabug
        /// </summary>
        /// <param name="elapsedTime">The in-game time between the previous and current frame</param>
        public override void Update(float elapsedTime)
        {
            // Pause the scrolling
            if (-ScrollingShooterGame.LevelManager.scrollDistance / 2 <= position.Y - 50) ScrollingShooterGame.LevelManager.Scrolling = false;

            // Sense the player's position
            PlayerShip player = ScrollingShooterGame.Game.Player;
            Vector2 playerPosition = new Vector2(player.Bounds.Center.X, player.Bounds.Center.Y);

            if (mandibles == false && ScrollingShooterGame.LevelManager.Scrolling == false)
            {
                _mandible1 = (Mandible)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.Mandible,
                  new Vector2(this.position.X - 30, this.position.Y));
                _mandible2 = (Mandible)ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.Mandible,
                    new Vector2(this.position.X + 11, this.position.Y));
                mandibles = true;
            }

            if (this.Health <= 200)
            {
                _mandible1.isFired = true;
                _mandible2.isFired = true;
            }
            if (stage == 1 && this.Health <= 100)
            {
                stage = 2;
                bug1 = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.Lavabug2,
                    new Vector2(this.position.X - 10, this.position.Y + 10));
                bug2 = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.Lavabug2,
                  new Vector2(this.position.X + 10, this.position.Y + 10));
            }

            if (stage == 2)
            {
                Health = 100;
                if (bug1.Health <= 0 && bug2.Health <= 0)
                    Health = 0;
            }

            // Move in front of player
            //this.position.Y = playerPosition.Y;
            this.position.X = playerPosition.X;

            //fire at player
            Fire(elapsedTime);
        }