Пример #1
0
        public TitleScreen(EventHandler callback, bool startMusic)
            : base(callback)
        {
            // initialize
            startTime = DateTime.Now;
            Game1.Game.Window.Title = "Welcome to Bill's lair.";
            Game1.Game.IsMouseVisible = true;
            isaac = new BaseObject(new Rectangle(0, 0, 100, 100), new Vector2(0, 0));
            isaac.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height / 2);

            startButton = new SimpleButton(new Rectangle(0, 0, STARTBUTTONWIDTH, STARTBUTTONHEIGHT), button1Texture, button1Texture, button2Texture);
            startButton.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, isaac.Y - 40);
            SimpleButton.AddButton(startButton);

            physicsButton = new BaseObject(new Rectangle(0, 0, INSTRUCTIONSBUTTONWIDTH, INSTRUCTIONSBUTTONHEIGHT), new Vector2(0, 0));
            physicsButton.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, isaac.Y + isaac.Height + 40);

            exitButton = new BaseObject(new Rectangle(0, 0, EXITBUTTONWIDTH, EXITBUTTONHEIGHT), new Vector2(0, 0));
            exitButton.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, physicsButton.Y + physicsButton.Height + 40);

            // load content
            if (!contentLoaded)
            {
                button1Texture = Content.Load<Texture2D>("titlebutton1");
                button2Texture = Content.Load<Texture2D>("titlebutton2");
                isaacTexture = Content.Load<Texture2D>("isaac");
                isaac1 = Content.Load<Texture2D>("isaacswirl1");
                isaac2 = Content.Load<Texture2D>("isaacswirl2");
                isaac3 = Content.Load<Texture2D>("isaacswirl3");
                isaac4 = Content.Load<Texture2D>("isaacswirl4");
                isaac5 = Content.Load<Texture2D>("isaacswirl5");
                titleFont1 = Content.Load<SpriteFont>("TitleFont1");
                titleFont2 = Content.Load<SpriteFont>("TitleFont2");
                titleTheme = Content.Load<Song>("titletheme");
                contentLoaded = true;
            }

            isaacAnimation = new Animation(1.5f, 6f, isaac1 , isaac2, isaac3, isaac4, isaac5, isaac4, isaac3, isaac2, isaac1);
            //isaacAnimation.Start();

            // play music
            if (startMusic)
            {
                MediaPlayer.Play(titleTheme);
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Volume = .25f;
            }
        }
Пример #2
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;
        }
Пример #3
0
 public AnimatedObject(Rectangle rectangle, Animation animation)
     : base(rectangle)
 {
     Animation = animation;
 }
Пример #4
0
        public AlexEnchanter(Rectangle rectangle)
            : base(rectangle)
        {
            speed = new Vector2(500, 500);
            warpOutAnimation = new Animation(warpAnimationDuration, WarpTextures);
            warpInAnimation = new Animation(warpAnimationDuration, WarpTextures[9], WarpTextures[8],
                WarpTextures[7], WarpTextures[6], WarpTextures[5], WarpTextures[4], WarpTextures[3],
                WarpTextures[2], WarpTextures[1], WarpTextures[0]);
            castAnimation = new Animation(castAnimationDuration, CastTextures[0],  CastTextures[1],
                CastTextures[2], CastTextures[3], CastTextures[4], CastTextures[5], CastTextures[6],
                CastTextures[7], CastTextures[8], CastTextures[9], CastTextures[8], CastTextures[7],
                CastTextures[6], CastTextures[5], CastTextures[4], CastTextures[3], CastTextures[2],
                CastTextures[1], CastTextures[0]);
            PeanutShield = new AnimatedObject(new Rectangle(0, 0, 0, 0), new Animation(-1, 45, PeanutShieldTextures[0], PeanutShieldTextures[1],
                PeanutShieldTextures[2], PeanutShieldTextures[3], PeanutShieldTextures[2],
                PeanutShieldTextures[1], PeanutShieldTextures[0]));
            createWarpLocations();
            magicStaff = new BaseObject(new Rectangle(0, 0, magicStaffWidth, magicStaffHeight));
            magicStaff.Texture = MagicStaffTexture;

            HP = MaxHP = DEFAULTMAXHP;
        }