Exemplo n.º 1
0
        public EndBattle1(EventHandler callback)
            : base(callback, false)
        {
            if (!contentLoaded)
            {
                endBattle1Font1     = Content.Load <SpriteFont>("EndBattle1Font1");
                actTitleFont        = Content.Load <SpriteFont>("ActTitleFont");
                keysTexture         = Content.Load <Texture2D>("carkeys");
                rollerBladesTexture = Content.Load <Texture2D>("rollerblades");
                wizardTexture       = Content.Load <Texture2D>("mikewizard");
                mikeTheme           = Content.Load <Song>("miketheme");
            }

            MediaPlayer.Stop();
            bill.speed           = new Vector2(4500, 4500);
            bill.Width          *= 2;
            bill.Height         *= 2;
            billHealthBar.Width *= 2;
            bill.HP              = 0;
            Bullet.Cans.Clear();
            PowerUp.RemoveAlivePowerUps();
            string status = "BAHUHUHUHUHUHUHUH";

            currentBillMessage      = LOWHPMESSAGE;
            Game1.Game.Window.Title = status;
            soundEffectManager.Play(billDeath, 1f);

            keys             = new BaseObject(new Rectangle(0, 0, 50, 50));
            keys.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height / 2);
            keys.Texture     = keysTexture;

            wizard             = new BaseObject(new Rectangle(0, 0, WIZARDWIDTH, WIZARDHEIGHT));
            wizard.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height * .48f);
            wizard.Texture     = wizardTexture;

            rollerBlades             = new BaseObject(new Rectangle(0, 0, ROLLERBLADESWIDTH, ROLLERBLADESHEIGHT));
            rollerBlades.CenterPoint = new Vector2(Graphics.GraphicsDevice.Viewport.Width / 2, Graphics.GraphicsDevice.Viewport.Height * .9f);
            rollerBlades.Texture     = rollerBladesTexture;
        }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                Game1.Game.Exit();
            }
            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape))
            {
                PowerUp.RemoveAlivePowerUps();
                returnControl("title");
                return;
            }

            if (part3Started && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter))
            {
                returnControl("entercarchase");
                return;
            }

            // mute check
            checkForMute();

            if (billRunning && bill.X >= Graphics.GraphicsDevice.Viewport.Width)
            {
                if ((DateTime.Now - startTime).TotalSeconds < 4)
                {
                    return;
                }
                billRunning  = false;
                part3Started = true;
                MediaPlayer.Play(mikeTheme);
                MediaPlayer.Volume = .5f;
            }

            if (part3Started)
            {
            }
            else
            {
                if ((DateTime.Now - startTime).TotalSeconds < 1)
                {
                    bill.moveTowards(isaac.CenterPoint, gameTime, true);
                    isaac.CalculateCorners();
                    bill.CalculateCorners();
                    checkForIsaacDeath();
                }
                else
                {
                    if (!part2Started)
                    {
                        Game1.Game.Window.Title = "";
                        part2Started            = true;
                    }
                    else
                    {
                        if ((DateTime.Now - startTime).TotalSeconds < 2)
                        {
                            return;
                        }
                        if (!billRunning)
                        {
                            bill.Width      /= 2;
                            bill.Height     /= 2;
                            bill.CenterPoint = new Vector2(-(bill.Width / 2), Graphics.GraphicsDevice.Viewport.Height / 2);
                            billRunning      = true;
                        }
                        else
                        {
                            bill.X += (int)Math.Round(Util.ScaleWithGameTime(1000, gameTime));
                            if (keys.Rectangle.Contains((int)bill.CenterPoint.X, (int)bill.CenterPoint.Y))
                            {
                                keysPickedUp = true;
                            }
                            if (keysPickedUp)
                            {
                                keys.CenterPoint = bill.CenterPoint;
                            }
                        }
                    }
                }
            }

            //SoundEffectManager.Cleanup();
        }
Exemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                Game1.Game.Exit();
            }
            if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape))
            {
                PowerUp.RemoveAlivePowerUps();
                returnControl("title");
                return;
            }

            // go to EndCarChase1
            if (timer.Elapsed.TotalSeconds >= TIMELIMIT)
            {
                Stats.CarChasePeanutScore = peanutCount;
                returnControl(isaac, bill);
                return;
            }

            // mute check
            checkForMute();

            // pause check
            if (Keyboard.GetState(PlayerIndex.One).IsKeyUp(Keys.P))
            {
                allowPause = true;
            }
            if (allowPause && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.P))
            {
                paused    ^= true;
                allowPause = false;
                if (paused)
                {
                    timer.Stop();
                    MediaPlayer.Pause();
                }
                else
                {
                    timer.Start();
                    MediaPlayer.Resume();
                }
            }
            if (paused)
            {
                return;
            }

            //show fps every 1 second
            fpsElapsedTime += gameTime.ElapsedGameTime;
            if (fpsElapsedTime > TimeSpan.FromSeconds(1))
            {
                fpsElapsedTime         -= TimeSpan.FromSeconds(1);
                Game1.Game.Window.Title = "FPS: " + frameCounter;
                //Game1.Game.Window.Title = "FPS: " + frameCounter + " | Projectiles: " + (Bullet.Peanuts.Count + Bullet.Cans.Count) + " | Powerups: " + PowerUp.AlivePowerUps.Count + " | Sound instances: " + SoundEffectManager.SoundEffectInstances.Count + ".";
                //Game1.Game.Window.Title = "Peanuts: " + Bullet.Peanuts.Length + " Cans: " + Bullet.Cans.Length + " Powerups: " + PowerUp.AlivePowerUps.Count;
                frameCounter = 0;
            }

            actualScrollSpeed = (int)Math.Round(Util.ScaleWithGameTime(scrollSpeed, gameTime));
            scrollBackground(gameTime);

            if (isaac.CenterPoint.X > Graphics.GraphicsDevice.Viewport.Width / 2)
            {
                bill.moveTowards(isaac.CenterPoint, gameTime, true);
            }
            else
            {
                moveBillRandom(gameTime);
            }
            movePeanutGenerator(gameTime);
            if (!wipingOut)
            {
                moveIsaac(gameTime);
            }
            movePeanutsAndCans();

            if (GameSettings.ProjectileRotationCollision)
            {
                isaac.CalculateCorners();
                bill.CalculateCorners();
                foreach (Bullet b in Bullet.Peanuts)
                {
                    b.CalculateCorners();
                }
                foreach (Bullet b in Bullet.Cans)
                {
                    b.CalculateCorners();
                }
            }

            checkForWipeOut(gameTime);
            checkForBillShoot(gameTime);
            checkForPeanutGeneratorShoot(gameTime);
            checkForPeanutPickUp();

            /*if (++cleanupCounter >= 60)
             * {
             *  SoundEffectManager.Cleanup();
             *  cleanupCounter = 0;
             * }*/
        }
Exemplo n.º 4
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;
            }
        }