public void loeschen(Spieler sp1) { if (this.x > 710 || this.x < -10 || this.y > 710 || this.y < -10) { sp1.zomlist.Remove(this); return; } }
public void bossschuss(Spieler sp1, Graphics l, System.Windows.Forms.Timer timer) { if (kugelaktiv == 0) { this.bosskglist.Add(new Kugel(this.x, this.y)); this.bosskglist.Add(new Kugel(this.x, this.y)); this.bosskglist.Add(new Kugel(this.x, this.y)); Vector v = new Vector(sp1.x - this.x, sp1.y - this.y); int laenge = Convert.ToInt32(v.Length); foreach (Kugel bosskg in bosskglist) { bosskg.speedx = Convert.ToInt32((v.X / laenge) * 10); bosskg.speedy = Convert.ToInt32((v.Y / laenge) * 10); } for (int i = 0; i < this.bosskglist.Count; i++) { bosskglist[i].x += i * bosskglist[i].speedx; bosskglist[i].y += i * bosskglist[i].speedy; } kugelaktiv = 3; } SolidBrush b = new SolidBrush(Color.White); for (int i = 0; i < this.bosskglist.Count; i++) { bosskglist[i].x += bosskglist[i].speedx; bosskglist[i].y += bosskglist[i].speedy; l.FillEllipse(b, bosskglist[i].x, bosskglist[i].y, 6, 6); } foreach (Kugel bosskg in bosskglist) { if (bosskg.x > 700 || bosskg.x < 0 || bosskg.y > 700 || bosskg.y < 0) { kugelaktiv--; bosskglist.Remove(bosskg); return; } if (Math.Sqrt(Math.Pow((sp1.x + 5) - (bosskg.x + 3), 2) + Math.Pow((sp1.y + 5) - (bosskg.y + 3), 2)) < 8) { sp1.leben--; if (sp1.leben <= 0) { sp1.stop(timer); return; } kugelaktiv--; bosskglist.Remove(bosskg); return; } } }