'Starfield code snippet.
'
'(C) Shockwave.
'
setrgb 0,0,0,0
nstr=90
dim x(nstr),y(nstr),z(nstr)
for a=1 to nstr
x(a)=-2000+ran(4000)
y(a)=-2000+ran(4000)
z(a)=ran(5)
next a
open window 640,512

repeat
setdrawbuf d
d=1-d
setdispbuf d
clear window
for a=1 to nstr
tx=320+(x(a)/z(a))
ty=256+(y(a)/z(a))
s=7-z(a)
c=(s*20)-40
setrgb 1,3,3,c
fill triangle tx,ty-s-s to tx+s,ty+s to tx-s,ty+s
fill triangle tx,ty+s+s to tx+s,ty-s to tx-s,ty-s
z(a)=z(a)-.05

if tx<0 or tx>640 or ty<0 or ty>512 then
x(a)=-2000+ran(4000)
y(a)=-2000+ran(4000)
z(a)=5
fi
next a
until (1=2)

