public ElFeroCactae(Vector2 scroll, String[] flags) : base(scroll) { //Source sprite sRect = new Rectangle(0, 0, 512, 512); Scale = new Vector2(1.3f, 1.3f); location = new Vector2(TGPAContext.Instance.TitleSafeArea.Right - this.dRect.Width, TGPAContext.Instance.ScreenHeight + 1); etat = CactusStateBoss.Attack; frametime = 400; ttl = InfiniteTimeToLive; //Stats wpn = new ElFeroCactaeWPN1(); wpn2 = new ElFeroCactaeWPN2(); wpn3 = new ElFeroCactaeWPN3(); wpn4 = new ElFeroCactaeWPN4(); attackDuration = 0.0f; hp = basicHP; maxLifebarValue = hp; speed = new Vector2(0f, 70.0f); Pattern = new MovePattern(); Pattern.AddPoint((int)location.X + dRect.Width / 2, 0); frametime = 0f; points = 125000; go = false; deltaX = -1; attacks = AttackBoss2.Circluar; this.hitbox = new EmptyHitbox(this); this.flagsOnDeath = flags; panel = new BackgroundActiveElement.ElFeroPanel(new Vector2(150, TGPAContext.Instance.ScreenHeight + 1)); TGPAContext.Instance.AddEnemy(panel); this.DrawLifebar = true; this.DrawWarning = true; }
public override void Update(GameTime gameTime) { attackDuration -= gameTime.ElapsedGameTime.TotalMilliseconds; if (attackDuration < 0) attackDuration = 0; if (frametime != 0) { frametime -= gameTime.ElapsedGameTime.TotalMilliseconds; if (frametime < 0) { frametime = 0; etat = CactusStateBoss.Attack; } } if ((IsHit) && (attacks != AttackBoss2.Grow)) { int oldWidth = this.dRect.Width; Vector2 newScale = this.Scale; newScale.X -= 0.003f; newScale.Y -= 0.003f; this.Scale = newScale; this.location.X += (oldWidth - this.dRect.Width) / 2; this.location.Y = TGPAContext.Instance.ScreenHeight - this.dRect.Height; } if (this.Scale.X < 0.35f) { attacks = AttackBoss2.Grow; attackDuration = 10000f; this.hitbox = new EmptyHitbox(this); } switch (etat) { case CactusStateBoss.Hit: sRect.Y = 512; dRect = ComputeDstRect(sRect); break; case CactusStateBoss.Attack: sRect.Y = 0; dRect = ComputeDstRect(sRect); break; } //Behavior //First thing : boss go to the middle of the screen if ((location.Y < (TGPAContext.Instance.ScreenHeight - dRect.Height)) && !go) { go = true; Background = true; speed = Vector2.Zero; Pattern = null; this.hitbox = new SquareHitbox(this, new Vector2(0.5f, 0f)); oldHitbox = (SquareHitbox)this.hitbox; } else if (!go) { Vector2 loc = panel.Location; loc.Y = this.location.Y; if (loc.Y < TGPAContext.Instance.ScreenHeight / 2) { loc.Y = TGPAContext.Instance.ScreenHeight / 2; } this.location.X = 450; loc.X += deltaX; panel.Location = loc; this.location.X += deltaX; deltaX = -deltaX; for (int i = 1; i <= 15; i++) { Vector2 smokeLoc = new Vector2(i * TGPAContext.Instance.ScreenWidth / 15, TGPAContext.Instance.ScreenHeight); TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(smokeLoc, RandomMachine.GetRandomVector2(-5f, 5f, -10f, 10f), 0.70f, 0.70f, 0.70f, 1f, RandomMachine.GetRandomFloat(0.5f, 2.0f), RandomMachine.GetRandomInt(0, 4)), true); } TGPAContext.Instance.Player1.SetRumble(new Vector2(1.0f, 1.0f)); if (TGPAContext.Instance.Player2 != null) { TGPAContext.Instance.Player2.SetRumble(new Vector2(1.0f, 1.0f)); } } base.Update(gameTime); }
public override List<Shot> Fire() { List<Shot> shots = new List<Shot>(); if (!go) return shots; if (attackDuration == 0f) { if (this.attacks == AttackBoss2.Grow) { this.hitbox = oldHitbox; } int rand = RandomMachine.GetRandomInt(0, 4); if (rand == 2) { attacks = AttackBoss2.Pause; attackDuration = 1000f; } else if (rand == 3) { attacks = AttackBoss2.SmallCactus; attackDuration = 50f; } else { ((ElFeroCactaeWPN1)wpn).SpecialInit(); attacks = AttackBoss2.Circluar; attackDuration = 2000f; } } switch (attacks) { case AttackBoss2.Circluar: shots = wpn.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.Pause: //shots = wpn2.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.SmallCactus: shots = wpn3.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.Grow: int oldWidth = this.dRect.Width; Vector2 newScale = this.Scale; newScale.X += 0.025f; newScale.Y += 0.025f; this.Scale = newScale; this.location.X -= (this.dRect.Width - oldWidth) / 2; this.location.Y = TGPAContext.Instance.ScreenHeight - this.dRect.Height; shots = wpn4.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; } return shots; }
public override List <Shot> Fire() { List <Shot> shots = new List <Shot>(); if (!go) { return(shots); } if (attackDuration == 0f) { if (this.attacks == AttackBoss2.Grow) { this.hitbox = oldHitbox; } int rand = RandomMachine.GetRandomInt(0, 4); if (rand == 2) { attacks = AttackBoss2.Pause; attackDuration = 1000f; } else if (rand == 3) { attacks = AttackBoss2.SmallCactus; attackDuration = 50f; } else { ((ElFeroCactaeWPN1)wpn).SpecialInit(); attacks = AttackBoss2.Circluar; attackDuration = 2000f; } } switch (attacks) { case AttackBoss2.Circluar: shots = wpn.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.Pause: //shots = wpn2.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.SmallCactus: shots = wpn3.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; case AttackBoss2.Grow: int oldWidth = this.dRect.Width; Vector2 newScale = this.Scale; newScale.X += 0.025f; newScale.Y += 0.025f; this.Scale = newScale; this.location.X -= (this.dRect.Width - oldWidth) / 2; this.location.Y = TGPAContext.Instance.ScreenHeight - this.dRect.Height; shots = wpn4.Fire(Vectors.ConvertPointToVector2(DstRect.Center)); break; } return(shots); }
public override void Update(GameTime gameTime) { attackDuration -= gameTime.ElapsedGameTime.TotalMilliseconds; if (attackDuration < 0) { attackDuration = 0; } if (frametime != 0) { frametime -= gameTime.ElapsedGameTime.TotalMilliseconds; if (frametime < 0) { frametime = 0; etat = CactusStateBoss.Attack; } } if ((IsHit) && (attacks != AttackBoss2.Grow)) { int oldWidth = this.dRect.Width; Vector2 newScale = this.Scale; newScale.X -= 0.003f; newScale.Y -= 0.003f; this.Scale = newScale; this.location.X += (oldWidth - this.dRect.Width) / 2; this.location.Y = TGPAContext.Instance.ScreenHeight - this.dRect.Height; } if (this.Scale.X < 0.35f) { attacks = AttackBoss2.Grow; attackDuration = 10000f; this.hitbox = new EmptyHitbox(this); } switch (etat) { case CactusStateBoss.Hit: sRect.Y = 512; dRect = ComputeDstRect(sRect); break; case CactusStateBoss.Attack: sRect.Y = 0; dRect = ComputeDstRect(sRect); break; } //Behavior //First thing : boss go to the middle of the screen if ((location.Y < (TGPAContext.Instance.ScreenHeight - dRect.Height)) && !go) { go = true; Background = true; speed = Vector2.Zero; Pattern = null; this.hitbox = new SquareHitbox(this, new Vector2(0.5f, 0f)); oldHitbox = (SquareHitbox)this.hitbox; } else if (!go) { Vector2 loc = panel.Location; loc.Y = this.location.Y; if (loc.Y < TGPAContext.Instance.ScreenHeight / 2) { loc.Y = TGPAContext.Instance.ScreenHeight / 2; } this.location.X = 450; loc.X += deltaX; panel.Location = loc; this.location.X += deltaX; deltaX = -deltaX; for (int i = 1; i <= 15; i++) { Vector2 smokeLoc = new Vector2(i * TGPAContext.Instance.ScreenWidth / 15, TGPAContext.Instance.ScreenHeight); TGPAContext.Instance.ParticleManager.AddParticle(new Smoke(smokeLoc, RandomMachine.GetRandomVector2(-5f, 5f, -10f, 10f), 0.70f, 0.70f, 0.70f, 1f, RandomMachine.GetRandomFloat(0.5f, 2.0f), RandomMachine.GetRandomInt(0, 4)), true); } TGPAContext.Instance.Player1.SetRumble(new Vector2(1.0f, 1.0f)); if (TGPAContext.Instance.Player2 != null) { TGPAContext.Instance.Player2.SetRumble(new Vector2(1.0f, 1.0f)); } } base.Update(gameTime); }