public Bowser(Vector2 location) { BossPhysics = new BossPhysicalProperty(this); State = new BowserMoveState(BossPhysics.IsFacingLeft); Location = location; deathTimer = Util.Instance.Bowser_deathtimer; IsControlled = false; canBeDamaged = true; IsActivate = false; damageTimer = 0; jumpTimer = 0; randomTimer = 0; turnTimer = 0; randomNum = RandomNumber(20); Life = Util.Instance.Bowser_life; randomHeight = RandomNumber(40); fireShots = new List <FireShot>(); shootTimer = 20; heightFactor = 0; }
public void Update(GameTime gametime) { randomHeight = RandomNumber(40); if (Life <= 0) { BeDead(); } if (!BossPhysics.IsAlive) { deathTimer++; } if (!canBeDamaged) { damageTimer++; } if (damageTimer == 50) { canBeDamaged = true; damageTimer = 0; } if (shootTimer == 0) { shootTimer = 20 + RandomNumber(100); Shoot(); } else { --shootTimer; } foreach (FireShot fireShot in fireShots) { fireShot.Update(gametime); } jumpTimer++; if (jumpTimer == 80) { if (randomNum % 2 == 0) { Jump(); } jumpTimer = 0; } randomTimer++; if (randomTimer == 160) { randomNum = RandomNumber(20); randomTimer = 0; } turnTimer++; if (turnTimer == 80) { if (randomNum % 3 == 0 && IsActivate) { BossPhysics.IsFacingLeft = !BossPhysics.IsFacingLeft; State = new BowserMoveState(BossPhysics.IsFacingLeft); } turnTimer = 0; } if (deathTimer == Util.Instance.Koopa_update_ref100) { deathTimer = Util.Instance.Koopa_deathtimer_update_100case; Location += new Vector2(0, 1000); } else { State.Update(gametime); BossPhysics.Update(gametime); BossPhysics.BossMove(); } }