Exemple #1
0
        public EndCarChase1(EventHandler callback, Character isaac, Character bill)
            : base(callback, false)
        {
            Game1.Game.Window.Title = "";

            //carChaseBackground1 = new Rectangle(0, 0, 480, 480);
            //carChaseBackground2 = new Rectangle(carChaseBackground1.X + carChaseBackground1.Width, 0, 480, 480);
            //carChaseBackground3 = new Rectangle(carChaseBackground2.X + carChaseBackground2.Width, 0, 480, 480);

            //bill.X = 0;
            //bill.Y = Graphics.GraphicsDevice.Viewport.Height / 2 - bill.Height / 2;
            //bill.Width = (int)(BILLCARSIZE * 1.34594595f);
            //bill.Height = BILLCARSIZE;
            //bill.X = -bill.Width;
            //bill.Y = Graphics.GraphicsDevice.Viewport.Height / 2 - bill.Height / 2;
            //bill.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .75f, Graphics.GraphicsDevice.Viewport.Height / 2);
            //bill.Speed = (int)(GameSettings.DEFAULTBILLSPEED * .5f);
            //billTarget = bill.CenterPoint;
            //bill.ShootDelay = (int)(500 / GameSettings.BillShootSpeed);
            this.bill = bill;
            bill.Speed = 100;
            billTarget = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .75f, Graphics.GraphicsDevice.Viewport.Height / 2);

            //isaac.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .25f, Graphics.GraphicsDevice.Viewport.Height / 2);
            //isaac.X = 0;
            //isaac.Y = Graphics.GraphicsDevice.Viewport.Height / 2 - isaac.Height / 2;
            this.isaac = isaac;
            isaac.Speed = 100;
            isaacTarget = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .25f, Graphics.GraphicsDevice.Viewport.Height / 2);

            if (!contentLoaded)
            {
                roadTexture = Content.Load<Texture2D>("roadbackground2");
                isaacTexture = Content.Load<Texture2D>("isaacdope");
                billCarTexture = Content.Load<Texture2D>("billcar1");
                carChaseMusic = Content.Load<Song>("carchasemusic");
                contentLoaded = true;
            }

            isaac.Texture = isaacTexture;
            bill.Texture = billCarTexture;

            startTimer.Start();

            /*MediaPlayer.Play(carChaseMusic);
            MediaPlayer.Volume = .25f;
            MediaPlayer.IsRepeating = true;*/
        }
Exemple #2
0
        public CarChase1(EventHandler callback)
            : base(callback, false)
        {
            //carChaseBackground1 = new Rectangle(0, 0, 480, 480);
            //carChaseBackground2 = new Rectangle(carChaseBackground1.X + carChaseBackground1.Width, 0, 480, 480);
            //carChaseBackground3 = new Rectangle(carChaseBackground2.X + carChaseBackground2.Width, 0, 480, 480);

            //bill.X = 0;
            //bill.Y = Graphics.GraphicsDevice.Viewport.Height / 2 - bill.Height / 2;
            bill.Width = (int)(BILLCARSIZE * 1.34594595f);
            bill.Height = BILLCARSIZE;
            bill.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .75f, Graphics.GraphicsDevice.Viewport.Height / 2);
            bill.Speed = (int)(GameSettings.DEFAULTBILLSPEED * .5f);
            billTarget = bill.CenterPoint;
            bill.ShootDelay = (int)(1000 / GameSettings.DEFAULTBILLSHOOTSPEED);
            //billTarget = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .75f, bill.Y + bill.Height / 2);

            isaac.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width * .25f, Graphics.GraphicsDevice.Viewport.Height / 2);
            isaac.Speed = GameSettings.DEFAULTISAACSPEED;
            //isaac.X = isaac.Width;
            //isaac.Y = Graphics.GraphicsDevice.Viewport.Height / 2 - isaac.Height / 2;

            peanutGenerator = new Character(new Rectangle(Graphics.GraphicsDevice.Viewport.Width, Graphics.GraphicsDevice.Viewport.Height / 2, 1, 1), new Vector2(PEANUTGENERATORSPEED, PEANUTGENERATORSPEED));
            peanutGeneratorTarget = peanutGenerator.CenterPoint;
            peanutGenerator.ShootDelay = PEANUTGENERATORSHOOTDELAY;

            peanutCount = 0;

            if (!contentLoaded)
            {
                roadTexture = Content.Load<Texture2D>("roadbackground2");
                isaacTexture = Content.Load<Texture2D>("isaacdope");
                billCarTexture = Content.Load<Texture2D>("billcar1");
                carChaseMusic = Content.Load<Song>("carchasemusic");
                timerFont = Content.Load<SpriteFont>("TitleFont2");
                contentLoaded = true;
            }

            isaac.Texture = isaacTexture;
            bill.Texture = billCarTexture;

            timer.Start();

            /*MediaPlayer.Play(carChaseMusic);
            MediaPlayer.Volume = .5f;
            MediaPlayer.IsRepeating = true;*/
        }
Exemple #3
0
        public Battle2(EventHandler callback)
            : base(callback)
        {
            if (!contentLoaded)
            {
                pauseFont = Content.Load<SpriteFont>("Battle1BillStatusFont");
                powerUpFont = Content.Load<SpriteFont>("Battle1PowerUpFont");
                alexEnchanterTexture = Content.Load<Texture2D>("alexenchanter");
                isaacTexture = Content.Load<Texture2D>("isaac");
                transparentTexture = Content.Load<Texture2D>("transparent");
                burntPeanutTexture = Content.Load<Texture2D>("peanutgray");
                battle2Music = Content.Load<Song>("battle2music");
                hurtSounds = new SoundEffect[3];
                hurtSounds[0] = Content.Load<SoundEffect>("hurt1");
                hurtSounds[1] = Content.Load<SoundEffect>("hurt2");
                hurtSounds[2] = Content.Load<SoundEffect>("hurt3");
                isaacHurtBadSound = Content.Load<SoundEffect>("isaachurtbad");
                alexLaugh = Content.Load<SoundEffect>("alexlaugh");
                alexEnchanterHitSound = Content.Load<SoundEffect>("OOT_Armos_Hit");
                //alexEnchanterHitSound = Content.Load<SoundEffect>("OOT_ReDead_Hump");
                peanutShieldDeflectSound = Content.Load<SoundEffect>("peanutShieldDeflect");
                potionDrinkSound = Content.Load<SoundEffect>("potiondrink");
                getPowerUpSound = Content.Load<SoundEffect>("getpowerup");
                useHammerSound = Content.Load<SoundEffect>("usehammersound");
                fireballHitSound = Content.Load<SoundEffect>("fireballhit");
                lowHealthBeep = Content.Load<SoundEffect>("lowhealthbeep");
                superFireballRoll = Content.Load<SoundEffect>("fireballrolling");
                peanutShieldBreakSound = Content.Load<SoundEffect>("peanutshieldbreaksound");
                powerUpBarTexture = Content.Load<Texture2D>("poweruptimebar");
                sledgeHammerTexture = Content.Load<Texture2D>("sledgehammer");
                hearts = new Texture2D[5];
                heartEmptyTexture = Content.Load<Texture2D>("heart_empty");
                heartOneQuarterTexture = Content.Load<Texture2D>("heart_onequarter");
                heartHalfTexture = Content.Load<Texture2D>("heart_half");
                heartThreeQuartersTexture = Content.Load<Texture2D>("heart_3quarters");
                heartFullTexture = Content.Load<Texture2D>("heart_Full");
                contentLoaded = true;
            }

            Game1.Game.IsMouseVisible = false;

            isaac = new Character(new Rectangle(Graphics.GraphicsDevice.Viewport.Width / 2 - ISAACWIDTH / 2, Graphics.GraphicsDevice.Viewport.Height - ISAACHEIGHT, ISAACWIDTH, ISAACHEIGHT), new Vector2(GameSettings.IsaacSpeed, GameSettings.IsaacSpeed));
            isaac.Texture = isaacTexture;
            isaac.HP = isaac.MaxHP = ISAAC_MAX_HP;
            isaac.ShootDelay = (int)(250 / GameSettings.IsaacShootSpeed);
            isaac.TimeSinceLastShot = isaac.ShootDelay;

            isaacHurtAnimation = new Animation(1, 50, transparentTexture, isaacTexture);
            lowHealthBeeping = new LoopingSoundEffect(lowHealthBeep, .25f);
            updateHearts();

            alexEnchanter = new AlexEnchanter(new Rectangle(Graphics.GraphicsDevice.Viewport.Width / 2 - ENCHANTERWIDTH / 2, 25, ENCHANTERWIDTH, ENCHANTERHEIGHT));
            alexEnchanter.Texture = alexEnchanterTexture;
            alex = alexEnchanter;
            alexHealthBar = new HealthBar(new Rectangle(0, 0, 200, 10));

            sledgeHammer = new BaseObject(new Rectangle(0, 0, SLEDGEHAMMERWIDTH, SLEDGEHAMMERHEIGHT), 0f);
            sledgeHammerOrigin = new BaseObject(new Rectangle(0, 0, 1, SLEDGEHAMMERHEIGHT), 0f);
            sledgeHammer.Texture = sledgeHammerTexture;

            superFireballRolling = new LoopingSoundEffect(superFireballRoll, .35f);

            soundEffectManager.Play(alexLaugh, .25f);

            MediaPlayer.Play(battle2Music);
            MediaPlayer.Volume = .25f;
            MediaPlayer.IsRepeating = true;
        }
Exemple #4
0
 void cleanup()
 {
     lowHealthBeeping.Stop();
     superFireballRolling.Stop();
     Laser2.Lasers.Clear();
     Fireball.Fireballs.Clear();
     PowerUp.AlivePowerUps.Clear();
     Potion.Potions.Clear();
     //SeekerSnake.SeekerSnakes.Clear();
     MouseSeeker.RemoveAll();
     Bullet.Peanuts.Clear();
     isaac = null;
     //alex = null;
 }
Exemple #5
0
        public Battle1(EventHandler callback, bool startMusic)
            : base(callback)
        {
            // initialize
            Game1.Game.IsMouseVisible = false;
            bill = new Character(new Rectangle(0, 0, BILLWIDTH, BILLHEIGHT), new Vector2(GameSettings.BillSpeed, GameSettings.BillSpeed));
            isaac = new Character(new Rectangle(Graphics.GraphicsDevice.Viewport.Width / 2 - ISAACWIDTH / 2, 0, ISAACWIDTH, ISAACHEIGHT), new Vector2(GameSettings.IsaacSpeed, GameSettings.IsaacSpeed));
            billHealthBar = new HealthBar(new Rectangle(0, 0, bill.Width, bill.Height / 12));
            billTarget = new Vector2(rand.Next(BILLWIDTH / 2, Graphics.GraphicsDevice.Viewport.Width - BILLWIDTH / 2), rand.Next(BILLHEIGHT / 2, Graphics.GraphicsDevice.Viewport.Height - BILLHEIGHT / 2));
            Bullet.Peanuts.Clear();
            Bullet.Cans.Clear();
            PowerUp.RemoveAlivePowerUps();
            startTime = timeOfLastDeath = DateTime.Now;
            bill.HP = bill.MaxHP = GameSettings.BillHP;
            bill.ShootDelay = (int)(1000 / GameSettings.BillShootSpeed);
            isaac.ShootDelay = (int)(250 / GameSettings.IsaacShootSpeed);
            isaac.TimeSinceLastShot = isaac.ShootDelay;
            isaac.Y = Graphics.GraphicsDevice.Viewport.Height - ISAACHEIGHT;
            billMessages = new string[] { "MUH", "MEH", "R U DUMB"};
            billHPString = "";
            billStatusString = "";
            sledgeHammer = new BaseObject(new Rectangle(0, 0, SLEDGEHAMMERWIDTH, SLEDGEHAMMERHEIGHT), 0f);
            sledgeHammerOrigin = new BaseObject(new Rectangle(0, 0, 1, SLEDGEHAMMERHEIGHT), 0f);
            allowPause = true;
            cleanupCounter = 0;
            generateIsaacSpawnPoints();

            // load content
            if (!contentLoaded)
            {
                deathSound = Content.Load<SoundEffect>("death");
                billHit = Content.Load<SoundEffect>("billhit");
                billDeath = Content.Load<SoundEffect>("billdeath");
                getPowerUp = Content.Load<SoundEffect>("getpowerup");
                canDeath = Content.Load<SoundEffect>("candeath");
                useHammer = Content.Load<SoundEffect>("usehammersound");
                music = Content.Load<Song>("battlemusic");
                billTexture = Content.Load<Texture2D>("bill");
                //billTexture = Content.Load<Texture2D>("billtransparent");
                //billTexture2 = Content.Load<Texture2D>("bill2transparent");
                isaacTexture = Content.Load<Texture2D>("isaac");
                isaacUsingHammerTexture = Content.Load<Texture2D>("isaacusinghammer");
                font1 = Content.Load<SpriteFont>("Battle1Font1");
                powerUpFont = Content.Load<SpriteFont>("Battle1PowerUpFont");
                billStatusFont = Content.Load<SpriteFont>("Battle1BillStatusFont");
                shieldTexture = Content.Load<Texture2D>("shield");
                powerUpBarTexture = Content.Load<Texture2D>("poweruptimebar");
                sledgeHammerTexture = Content.Load<Texture2D>("sledgehammer");
                contentLoaded = true;
            }

            bill.Texture = billTexture;
            isaac.Texture = isaacTexture;
            sledgeHammer.Texture = sledgeHammerTexture;

            if (startMusic)
            {
                MediaPlayer.Play(music);
                MediaPlayer.Volume = .25f;
                MediaPlayer.IsRepeating = true;
            }
        }
Exemple #6
0
        void updateStaff(GameTime gameTime, Character isaac)
        {
            if (staffIsTurning)
            {
                float targetAngle = (float)Math.Atan2(MagicStaffPoint.Y - isaac.CenterPoint.Y, MagicStaffPoint.X - isaac.CenterPoint.X) - (float)Math.PI;

                float targetX = (float)Math.Cos(targetAngle);
                float targetY = (float)Math.Sin(targetAngle);

                Vector3 oldAngleVector = new Vector3((float)Math.Cos(magicStaff.Rotation), (float)Math.Sin(magicStaff.Rotation), 0);
                Vector3 newAngleVector = new Vector3(targetX, targetY, 0);

                Vector3 crossProduct = Vector3.Cross(oldAngleVector, newAngleVector);

                if (crossProduct.Z > 0)
                    magicStaff.Rotation += Util.ScaleWithGameTime(magicStaffRotationSpeed, gameTime);
                else if (crossProduct.Z < 0)
                    magicStaff.Rotation -= Util.ScaleWithGameTime(magicStaffRotationSpeed, gameTime);

                if (Util.AngleDifference(magicStaff.Rotation, targetAngle) < Util.ScaleWithGameTime(magicStaffRotationSpeed, gameTime))
                {
                    magicStaff.Rotation = targetAngle;
                    staffIsTurning = false;
                    //timeSinceStaffStoppedTurning = 0;
                }
            }
        }
Exemple #7
0
        void shootMice(Character isaac)
        {
            Vector2 mousePoint = MagicStaffPoint + new Vector2(magicStaff.Width * (float)Math.Cos(magicStaff.Rotation), magicStaff.Width * (float)Math.Sin(magicStaff.Rotation));
            BaseObject target = new BaseObject(new Rectangle((int)isaac.CenterPoint.X, (int)isaac.CenterPoint.Y, 1, 1));

            float beginAngle = magicStaff.Rotation - (float)Math.PI / 2;
            float endAngle = magicStaff.Rotation + (float)Math.PI / 2;

            int numberOfMice = 10;
            //float rotation = (float)Math.PI / numberOfMice;
            float rotation = MathHelper.TwoPi / numberOfMice;

            for (int i = 0; i < numberOfMice; i++, beginAngle += rotation)
            {
                //MouseSeeker m = new MouseSeeker(mousePoint, 300, 15, 2, 25, isaac, 2);
                MouseSeeker m = new MouseSeeker(mousePoint, miceSpeed, miceSize, cordSize, miceLength, magicStaff.Rotation, 5);
                m.Angle = beginAngle;
            }
        }
Exemple #8
0
        void castCircularLaser(GameTime gameTime, Character isaac)
        {
            if (circularLaserLeftAngle <= -270.5f)
            {
                circularLaserLeftAngle = circularLaserRightAngle = -90f;
                castingCircularLaser = false;
                timeSinceLastLaser = 0;
                return;
            }

            timeSinceLastCircularLaserShot += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (timeSinceLastCircularLaserShot >= circularLaserDelay)
            {
                timeSinceLastCircularLaserShot = 0;
                float oldSpeed = laserSpeed;
                laserSpeed = 250;

                shootLaserLeft(circularLaserLeftAngle);
                shootLaserRight(circularLaserRightAngle);

                laserSpeed = oldSpeed;

                circularLaserLeftAngle -= Util.ScaleWithGameTime(circularLaserRotation, gameTime);
                circularLaserRightAngle += Util.ScaleWithGameTime(circularLaserRotation, gameTime);
            }
        }
Exemple #9
0
        void shootFireballPredict(Character isaac)
        {
            if (!isaac.IsMoving)
            {
                shootFireball(isaac.CenterPoint);
                return;
            }

            float isaacMoveAngle = (float)Math.Atan2(isaac.LastMove.Y, isaac.LastMove.X);

            /*float distance = Vector2.Distance(FireballPoint, isaac.CenterPoint + new Vector2(isaac.speed.X * (float)Math.Cos(isaacMoveAngle), isaac.speed.Y * (float)Math.Sin(isaacMoveAngle)));
            float distanceToSpeedRatio = distance / fireballSpeed;

            Vector2 predictedPoint = isaac.CenterPoint + new Vector2(isaac.speed.X * distanceToSpeedRatio * (float)Math.Cos(isaacMoveAngle), isaac.speed.Y * distanceToSpeedRatio * (float)Math.Sin(isaacMoveAngle));
            */

            //Vector2 predictedPoint = isaac.CenterPoint + new Vector2((float)Math.Cos(isaacMoveAngle), (float)Math.Sin(isaacMoveAngle));

            Vector2 fireballPoint = FireballPoint;
            Vector2 predictedPoint = isaac.CenterPoint;
            float fireballDistance, isaacDistance, fireballRatio, isaacRatio;

            do
            {
                fireballDistance = Vector2.Distance(fireballPoint, predictedPoint);
                isaacDistance = Vector2.Distance(isaac.CenterPoint, predictedPoint);
                fireballRatio = fireballDistance / fireballSpeed;
                isaacRatio = isaacDistance / isaac.speed.X;

                predictedPoint += new Vector2((float)Math.Cos(isaacMoveAngle), (float)Math.Sin(isaacMoveAngle));
            }
            //while (fireballRatio - isaacRatio > .001f);
            while (fireballRatio - isaacRatio > .5f);

            shootFireball(predictedPoint);
            //shootFireball(predictedPoint - new Vector2(isaacDistance * (float)Math.Cos(isaacMoveAngle) / 2, isaacDistance * (float)Math.Sin(isaacMoveAngle) / 2));
        }
Exemple #10
0
        // spells
        void checkForSpells(GameTime gameTime, Character isaac)
        {
            if (!IsCasting)
                timeSinceLastSpell += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (timeSinceLastSpell >= spellDelay)
            {
                int n;
                do
                {
                    n = rand.Next(4);

                    float hpPercent = HP / (float)MaxHP;

                    if (n == 1 && hpPercent > .9f)
                        continue;

                    if (n == 2 && hpPercent > .75f)
                        continue;

                    if (n == 3 && hpPercent > .5f)
                        continue;
                    if (hasPeanutShield && n == 3)
                        continue;

                    break;
                }
                while (true);
                //int n = 3;
                if (n == 0)
                {
                    castingMice = true;
                    startUsingStaff();
                }
                else if (n == 1)
                {
                    castingSuperFireball = true;
                    castAnimation.Start();
                }
                else if (n == 2)
                {
                    castingCircularLaser = true;
                    timeSinceLastCircularLaserShot = circularLaserDelay;
                }
                else if (n == 3)
                {
                    PeanutShield.Width = PeanutShield.Height = 0;
                    castingPeanutShield = true;
                    castAnimation.Start();
                }
                timeSinceLastSpell = 0;
            }

            if (castingMice)
                castMice(gameTime, isaac);
            else if (castingCircularLaser)
                castCircularLaser(gameTime, isaac);
            else if (castingSuperFireball)
                castSuperFireball(gameTime, isaac);
            else if (castingPeanutShield)
                castPeanutShield(gameTime);
        }
Exemple #11
0
        // laser stuff
        void checkForShootLaser(GameTime gameTime, Character isaac)
        {
            timeSinceLastLaser += (int)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (timeSinceLastLaser >= laserDelay)
            {
                shootLaserBoth(isaac.CenterPoint);
                timeSinceLastLaser = 0;
            }
        }
Exemple #12
0
        // fireball stuff
        void checkForShootFireball(GameTime gameTime, Character isaac)
        {
            timeSinceLastFireball += (int)gameTime.ElapsedGameTime.TotalMilliseconds;

            if (timeSinceLastFireball >= fireballDelay)
            {
                //shootFireball(isaac.CenterPoint);
                shootFireballPredict(isaac);
                timeSinceLastFireball = 0;
            }
        }
Exemple #13
0
        void castSuperFireball(GameTime gameTime, Character isaac)
        {
            castAnimation.Update();
            if (!castAnimation.IsRunning)
            {
                Vector2 position = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - SUPERFIREBALLSIZE / 2, -SUPERFIREBALLSIZE);
                float angle = (float)Math.Atan2((double)(isaac.CenterPoint.Y - position.Y), (double)(isaac.CenterPoint.X - position.X));

                float moveX = SUPERFIREBALLSPEED * (float)Math.Cos(angle);
                float moveY = SUPERFIREBALLSPEED * (float)Math.Sin(angle);

                new Fireball(position, new Vector2(moveX, moveY), SUPERFIREBALLSIZE);

                Game1.Game.SoundEffectManager.Play(SuperFireballEnterSound, .15f);

                castingSuperFireball = false;
            }
        }
Exemple #14
0
        void castMice(GameTime gameTime, Character isaac)
        {
            if (staffIsTurning)
            {
                updateStaff(gameTime, isaac);
                return;
            }

            miceDelayTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (!miceCasted)
            {
                if (miceDelayTime >= micePreDelay)
                {
                    shootMice(isaac);

                    miceCasted = true;
                    miceDelayTime = 0;
                }
            }
            else
            {
                if (miceDelayTime >= micePostDelay)
                {
                    castingMice = false;
                    timeSinceLastLaser = 0;
                    usingStaff = false;
                    miceCasted = false;
                    miceDelayTime = 0;
                }
            }
        }
Exemple #15
0
 void canExplosion()
 {
     Vector2 target;
     Character center = new Character(new Rectangle(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height / 2, 1, 1), new Vector2());
     for (int i = 0; i < 500; i++)
     {
         target = new Vector2(rand.Next(Graphics.GraphicsDevice.Viewport.Width), rand.Next(Graphics.GraphicsDevice.Viewport.Height));
         center.shootBullet(BulletType.Cans[rand.Next(BulletType.Cans.Length)], target, 1000);
     }
 }
Exemple #16
0
 public virtual void Update(GameTime gameTime, Character isaac)
 {
 }
Exemple #17
0
        public override void Update(GameTime gameTime, Character isaac)
        {
            if (!IsCasting)
                checkForWarp(gameTime);

            if (!IsWarping)
            {
                checkForSpells(gameTime, isaac);
                if (!IsCasting)
                {
                    checkForShootLaser(gameTime, isaac);
                    checkForShootFireball(gameTime, isaac);
                }
            }

            if (castingPeanutShield || HasPeanutShield)
            {
                PeanutShield.CenterPoint = CenterPoint;
                PeanutShield.Animation.Update();
            }
        }