bool isaacHurt(int damage, SoundEffect sound, float volume) { //soundEffectManager.Play(deathSound, 1f); //timeOfLastDeath = DateTime.Now; //isaac.removePowerUpsExcept(PowerUpType.SledgeHammer, PowerUpType.CanShield); //isaac.reduceCanShieldCharges(); //Stats.PeanutShots -= Bullet.Peanuts.Count; //Bullet.Peanuts.Clear(); //sledgeHammerInUse = false; soundEffectManager.Play(sound, volume); isaacHurtAnimation.Start(); isaac.HP -= damage; if (isaac.HP == 0) { return(true); } else { return(false); } }
// warp stuff void checkForWarp(GameTime gameTime) { if (!IsWarping) { timeSinceLastWarp += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (timeSinceLastWarp >= warpDelay) { warpOutAnimation.Start(); warpingOut = true; timeSinceLastWarp = 0; } if (warpingOut) { Shrink(warpShrinkAmountX, warpShrinkAmountY); warpOutAnimation.Update(); if (!warpOutAnimation.IsRunning) { randomWarp(); warpInAnimation.Start(); warpingOut = false; warpingIn = true; } } if (warpingIn) { Grow(warpShrinkAmountX, warpShrinkAmountY, WIDTH, HEIGHT); warpInAnimation.Update(); if (!warpInAnimation.IsRunning) { Width = WIDTH; Height = HEIGHT; warpingIn = false; } } }
public override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || (exitButton.Rectangle.Contains(Mouse.GetState().X, Mouse.GetState().Y) && Mouse.GetState().LeftButton == ButtonState.Pressed)) { Game1.Game.Exit(); } MouseState mouseState = Mouse.GetState(); /*if (startButton.Rectangle.Contains(Mouse.GetState().X, Mouse.GetState().Y) && Mouse.GetState().LeftButton == ButtonState.Pressed) * { * returnControl("enterbill"); * return; * }*/ SimpleButton.UpdateAll(mouseState); if (startButton.Triggered) { cleanup(); returnControl("enterbill"); return; } else if (physicsButton.Rectangle.Contains(Mouse.GetState().X, Mouse.GetState().Y) && Mouse.GetState().LeftButton == ButtonState.Pressed) { cleanup(); returnControl("physics"); return; } // mute check checkForMute(); // go to test if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.T) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.E) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.S)) { cleanup(); returnControl("test"); } // go to shooter level if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.S) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.H) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.T)) { cleanup(); returnControl("shooter"); } // go to rts if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.R) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.T) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.S)) { cleanup(); returnControl("rts"); } // skip to act 2 if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.S) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.K) && Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.I)) { cleanup(); returnControl("entercarchase"); } // animate isaac int secondsElapsed = (int)(DateTime.Now - startTime).TotalSeconds; //if (!isaacAnimation.IsRunning && secondsElapsed != 0 && secondsElapsed % 5 == 0) if (!isaacAnimation.IsRunning && secondsElapsed % 5 == 0) { isaacAnimation.Start(); } isaacAnimation.Update(); }