Types weg und mit Array arbeiten oder .... ?
Code: Alles auswählen
Type star
Field x,y
End Type
For t=1 To 300:s.star=New star:s\x=Rand(5,795):s\y=Rand(5,120):Next
For s.star=Each star
Color 255,255,255
Rect s\x,s\y,1,1
NextCode: Alles auswählen
Type star
Field x,y
End Type
For t=1 To 300:s.star=New star:s\x=Rand(5,795):s\y=Rand(5,120):Next
For s.star=Each star
Color 255,255,255
Rect s\x,s\y,1,1
NextCode: Alles auswählen
Structure star
x.l
y.l
EndStructure
NewList star.star()
For t=1 To 300
x=Random(795)
y=Random(120)
AddElement(star())
*********************** star()=
Next
ForEach star()
*********************** Box(x,y,1,1,RGB(255,255,255))
NextCode: Alles auswählen
Structure s_Stern
xPos.l
yPos.l
EndStructure
Dim Stern.s_Stern(299)
For intI = 0 To 299
Stern(intI)\xPos=Random(795)
Stern(intI)\yPos=Random(120)
Next intI
For intI = 0 To 299
Box(Stern(intI)\xPos,Stern(intI)\yPos,1,1,RGB(255,255,255))
Next intI
Gamer hat geschrieben:1) Wie adde ich aber den x + y-Wert in die List?
2) Und wie lese ich die wieder aus?
Code: Alles auswählen
For t=1 To 300
AddElement(star())
star()\x = Random(795)
star()\y = Random(120)
Next
ResetList(star())
While NextElement(star())
Box(star()\x, star()\y, 1, 1, RGB(255,255,255))
Wend