Nein, du kannst so weit ich weis nicht sagen "hey Random: dashier gehört nicht dazu!

"
Du könntest es so machen:
Angenommen deine Panels sind 100x100 pixel groß.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:
| procedure TForm1.panelpos; var p1x,p1y,p2x,p2y,p3x,p3y :integer; begin p1x:=Random(5)*100; p1y:=Random(5)*100; p2x:=Random(5)*100; p2y:=Random(5)*100; p3x:=Random(5)*100; p3y:=Random(5)*100;
while ((p1x=p2x) and (p1y=p2y)) or ((p1x=p3x) and (p1y=p3y)) or ((p2x=p3x) and (p2y=p3y)) do begin p1x:=Random(5)*100; p1y:=Random(5)*100; p2x:=Random(5)*100; p2y:=Random(5)*100; p3x:=Random(5)*100; p3y:=Random(5)*100; end; Panel1.Left:=p1x; Panel1.Top :=p1y; Panel2.Left:=p2x; Panel2.Top :=p2y; Panel3.Left:=p3x; Panel3.Top :=p3y; Label1.Caption:='x: '+inttostr(p1x)+' y: '+inttostr(p1y); Label2.Caption:='x: '+inttostr(p2x)+' y: '+inttostr(p2y); Label3.Caption:='x: '+inttostr(p3x)+' y: '+inttostr(p3y); end; |
Ist getestet:
die Panels bewegen sich nie übereinander und überlappen sich nie. sind dafür eben immer in einem Raster (5x5), es gibt also genau 25 positionen wo die panels sind.
Ich hoffe ich konnte helfen. Genaue Erklärung: FRAG ^^
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.