here's a starfield:
; this is executed in the main loop:
If veteran=0
veteran=1
grapw=GraphicsWidth()
graph=GraphicsHeight()
grapw2=grapw/2
graph2=graph/2
For i=0 To nnn
star_x#(i)=Rnd(0,grapw)
star_y#(i)=Rnd(0,graph)
star_speed#(i)=Rnd(1.01,1.1)
star_col(i)=0
Next
calc_stars(nnn)
EndIf
Cls()
calc_stars(nnn)
draw_stars(nnn)
;this is For Globals, Arrays, Media-Preloading And Functions
Global veteran=0
Global grapw=0
Global graph=0
Global grapw2=0
Global graph2=0
Global nnn=500
Dim star_x#(nnn)
Dim star_y#(nnn)
Dim star_x2#(nnn)
Dim star_y2#(nnn)
Dim star_speed#(nnn)
Dim star_col(nnn)
Function calc_stars(n)
For i=0 To n
star_x2#(i)=star_x#(i)
star_y2#(i)=star_y#(i)
star_x#(i)=star_x#(i)-grapw2
star_y#(i)=star_y#(i)-graph2
star_x#(i)=star_x#(i)*star_speed#(i)
star_y#(i)=star_y#(i)*star_speed#(i)
star_x#(i)=star_x#(i)+grapw2
star_y#(i)=star_y#(i)+graph2
star_col(i)=star_col(i)+20
If star_col(i)>255
star_col(i)=255
EndIf
If (star_x#(i)<-50) Or (star_x#(i)>(grapw+70)) Or (star_y#(i)<-50) Or (star_y#(i)>(graph+50))
star_col(i)=0
star_x#(i)=Rnd(0,grapw)
star_y#(i)=Rnd(0,graph)
star_x2#(i)=star_x#(i)
star_y2#(i)=star_y#(i)
EndIf
Next
End Function
Function draw_stars(n)
For i=0 To n
x#=star_x#(i)
y#=star_y#(i)
x2#=star_x2#(i)
y2#=star_y2#(i)
Color(star_col(i),star_col(i),star_col(i))
Line(star_x#(i),star_y#(i),star_x2#(i),star_y2#(i))
Next
End Function