public KingPoulpi(Vector2 scroll, String[] flags) : base(scroll) { //Source sprite this.sRect = new Rectangle(0, 0, 600, 720); dRect = ComputeDstRect(sRect); eyesSRect = new Rectangle(645, 47, 154, 131); eyesLoc = new Vector2(110, 285); appendiceSRect = new Rectangle(26, 861, 160, 144); appendiceLoc = new Vector2(240, 570); this.location = new Vector2(TGPAContext.Instance.ScreenWidth / 2, 150);//TODO DMA this.ttl = InfiniteTimeToLive; //Stats this.wpn = null; this.hp = 10001; this.maxLifebarValue = hp; this.speed = Vector2.Zero; this.points = 500000; this.attackState = KingPoulpiAttacks.None; this.attackCooldown = 2500f; this.state = KingPoulpiState.Normal; this.flagsOnDeath = flags; this.InfiniteMovePattern = true; this.hitbox = new EmptyHitbox(this); this.DrawLifebar = true; this.DrawWarning = true; }
public override void Update(GameTime gameTime) { bool attack = true; //Decrease cooldowns if (this.faceCooldown > 0f) { this.faceCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; } if (this.attackCooldown > 0f) { this.attackCooldown -= gameTime.ElapsedGameTime.TotalMilliseconds; attack = false; } //Change state is necessary if ((this.faceCooldown < 0f) && (this.state != KingPoulpiState.Normal)) { this.state = KingPoulpiState.Normal; } //Boss is hit : change face if (IsHit) { this.state = KingPoulpiState.Hit; this.faceCooldown = 500f; } //Find attack if (attack) { if (this.attackState == KingPoulpiAttacks.None) { this.hitbox = new SquareHitbox(this, new Vector2(0.5f, 0)); } this.state = KingPoulpiState.Attack; this.faceCooldown = 2000f; this.speed = new Vector2(-150f, 50f); this.wpn = null; int rand = RandomMachine.GetRandomInt(0, 6); if ((this.movePattern == null) || (this.movePattern.Points.Count != 5)) { } } //Facial animation switch (this.state) { case KingPoulpiState.Normal: //sRect.X = 0; break; case KingPoulpiState.Attack: //sRect.X = 512; break; case KingPoulpiState.Hit: //sRect.X = 1024; break; } base.Update(gameTime); }