Exemple #1
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 #2
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;
            }
        }