public Clipper(Game game, double x, double y) : base(game, x, y) { shieldPhase = 0; shieldRadius = 128; targetRadius = 128; funnels = new Funnel[NUM_FUNNEL]; for (int i = 0; i < NUM_FUNNEL; i++) { double fx = x + Utility.Cos(shieldPhase + 360 / NUM_FUNNEL * i) * shieldRadius; double fy = y - Utility.Sin(shieldPhase + 360 / NUM_FUNNEL * i) * shieldRadius / 2; funnels[i] = new Funnel(game, fx, fy); } moveCount = game.Random.Next(30, 45); targetX = game.Random.Next(Game.FieldWidth / 2 - 192, Game.FieldWidth / 2 + 192 + 1); targetY = game.Random.Next(Game.FieldHeight / 4 - 64, Game.FieldHeight / 4 + 64 + 1); attackCount = game.Random.Next(30, 60); hitPoints = 32; damaged = false; isDead = false; animation = 0; }
public override void Update() { if (hitPoints <= 16) { targetRadius = 96; } if (hitPoints <= 8) { targetRadius = 64; } if (shieldRadius < targetRadius) { shieldRadius++; } else if (shieldRadius > targetRadius) { shieldRadius--; } shieldPhase -= 4; if (shieldPhase < 0) { shieldPhase += 360; } if (moveCount > 0) { moveCount--; } else { moveCount = Game.Random.Next(30, 45); targetX = Game.Random.Next(Game.FieldWidth / 2 - 192, Game.FieldWidth / 2 + 192 + 1); targetY = Game.Random.Next(Game.FieldHeight / 4 - 64, Game.FieldHeight / 4 + 64 + 1); } X = targetX * 0.03125 + X * 0.96875; Y = targetY * 0.03125 + Y * 0.96875; for (int i = 0; i < NUM_FUNNEL; i++) { funnels[i].X = X + Utility.Cos(shieldPhase + 360 / NUM_FUNNEL * i) * shieldRadius; funnels[i].Y = Y - Utility.Sin(shieldPhase + 360 / NUM_FUNNEL * i) * shieldRadius / 2; } if (attackCount > 0) { attackCount--; } else { if (!Game.Player.IsDead) { Funnel funnel = funnels[Game.Random.Next(0, NUM_FUNNEL)]; Bullet bullet = new ClipperBullet(Game, funnel.X, funnel.Y + 32, 16, 270); Game.AddEnemyBullet(bullet); Game.PlaySound(Sound.EnemyFire); } if (hitPoints > 16) { attackCount = Game.Random.Next(30, 60); } else if (hitPoints > 8) { attackCount = Game.Random.Next(15, 30); } else { attackCount = Game.Random.Next(10, 20); } } damaged = false; animation = (animation + 1) % 32; }