public Bullet(float x, float y, float BulletSpeed, float damage,Enemy target) { Location = new Vector2(x, y); this.damage = damage; Target = target; bulletSpeed = BulletSpeed; }
public void getEnemy() { if (Game1.eyes.Count > 0) { int shortest = -1; float shortestDistance = 10000; for (int i = 0; i < Game1.eyes.Count; i++) { float distance = Math.Abs(Vector2.Distance(Center, Game1.eyes[i].Center())); if (distance <= Range) if (distance < shortestDistance) { shortest = i; shortestDistance = distance; } } if (shortest != -1) { hasTarget = true; Target = Game1.eyes[shortest]; } else hasTarget = false; } else hasTarget = false; }