Or for 3D games:
sync on
sync rate 100
`turn on backdrop and color it black(space)
backdrop on
color backdrop 0
`create a cube
make object cube 1,5
`Create stars
dim Star(150, 3)
`setup stars
for i = 1 to 150
Star(i,1) = rnd(500)
Star(i,2) = rnd(360)
Star(i,3) = 1 + rnd(4)
next i
`This will cause ALL 2D Render first, so the cube will be displayed
`before the stars
draw to back
`start loop
ink rgb(255,255,255),0
do
for s = 1 to 150
`handle stars
if Star(s,1) < 500
Star(s,1) = Star(s,1) + Star(s,3)
else
Star(s,1) = 0
Star(s,2) = rnd(360)
Star(s,3) = 1 + rnd(4)
endif
`draw lines
line 320+(cos(Star(s,2))*Star(s,1)),240+(sin(Star(s,2))*Star(s,1)),320+(cos(Star(s,2))*(Star(s,1)+int(Star(s,1)/20))),240+(sin(Star(s,2))*(Star(s,1)+int(Star(s,1)/20)))
next s
`hide white point in the center
ink 0,0
dot 320,240
`reset color
ink rgb(255,255,255),0
`yrotate object
yrotate object 1,wrapvalue(object angle y(1)-1)
sync
loop