'+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'+             3D starfeild by Gareth Bailey             +
'+                      July 2002                        +
'+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +


open window 640,512
focus=2000: point=100
dim x(point),y(point),z(point),xx(point),yy(point)

for a=1 to point
  x(a)=-320+ran(640)
  y(a)=-256+ran(512)
  z(a)=-2000+int(ran(4000))
next a

label loop
clear window

for a=1 to point
  xx(a)=x(a)/((z(a)/focus)+1)+320
  yy(a)=y(a)/((z(a)/focus)+1)+256

 col   = ((2000-z(a))/16)
 setrgb 1,65+col,125+col,146+col
 setrgb 0,65,125,146

  fill rect xx(a),yy(a) to xx(a)+3,yy(a)+3
  z(a)=z(a)-50
  
  if z(a)<-2000 then 
    x(a)=-320+ran(640)
    y(a)=-256+ran(512)
    z(a)=2000
  fi

next a 
gosub db
goto loop

label db
setdispbuf draw
draw =1-draw
setdrawbuf draw
return






