[color=#000080][i]// AllShoots: TList;[/i][/color]
[b]procedure[/b] TForm1.Fire; [color=#000080][i]// Schuss abgeben[/i][/color]
[b]var[/b]
p: PPoint;
[b]begin[/b]
New(p);
p^.x := lblGun.Left + (lblGun.Width [b]div[/b] 2);
p^.y := lblGun.Top;
AllShoots.Add(p); [color=#000080][i]// neuen Schuss zu Liste hinzufügen[/i][/color]
[b]end[/b];
[b]procedure[/b] TForm1.DeleteDeadShoots(DeleteAll: Boolean);
[b]var[/b]
p: PPoint;
ii: Integer;
[b]begin[/b]
[b]for[/b] ii := AllShoots.Count -1 [b]downto[/b] 0 [b]do[/b]
[b]begin[/b]
p := PPoint(AllShoots.Items[ii]);
[b]if[/b] (p^.y < 0) [b]or[/b] (DeleteAll) [b]then[/b]
[b]begin[/b]
AllShoots.Delete(i); [color=#000080][i]// deswegen die Schleife rückwärts durchlaufen[/i][/color]
Dispose(p);
[b]end[/b];
[b]end[/b];
[b]end[/b];
[b]procedure[/b] TForm1.Timer1Timer(Sender: TObject);
[b]var[/b]
p: PPoint;
ii: Integer;
[b]begin[/b]
[b]for[/b] ii := 0 [b]to[/b] AllShoots.Count -1 [b]do[/b]
[b]begin[/b]
p := PPoint(AllShoots.Items[ii]);
Shoot(p^.x, p^.y);
Dec(p^.y, 5);
[b]end[/b];
DeleteDeadShoots(False);
[b]end[/b];
[b]procedure[/b] TForm1.FormDestroy...
[b]begin[/b]
DeleteDeadShoots(True); [color=#000080][i]// speicher freigeben[/i][/color]
[b]end[/b];