'x 0 'array subscripts 'y 1 'z 2 'zvel 3 'velocity 'ox 4 'old x 'oy 5 const MAXSTARS = 200 'number of stars const LENS = 256 const XMAX = 640 const YMAX = 480 const XMID = XMAX/2 const YMID = YMAX/2 const PI = 3.141593 dim stars(5,MAXSTARS) dim colors(2, 255) for i =0 to 255 'a lil hack I made to simulate 256 colors(0, i) = i 'colors in 24 bit? colors(1, i) = i colors(2, i) = i next i for i = 0 to MAXSTARS stars(0, i) = -XMID/2 + INT(RND * XMID) stars(1, i) = -YMID/2 + INT(RND * YMID) stars(2, i) = INT(RND * LENS) stars(3, i) = 2 ' + INT(RND * 5) next i rect 0, 0, XMAX,YMAX, color 0 filled repeat '///Move the stars '//Z=0 is 256 units away from the screen '//Adding values to Z moves the pixel towards us '//if Z > 256, the star is over our screen so reinitialize '//the stars Z value to 0(256 units away). angleZ = angleZ + 1 rangleZ = angleZ * PI / 180 'convert to radians cosz = COS(rangleZ) 'precalc sinz = SIN(rangleZ) FOR i = 0 TO MAXSTARS Stars(2,i) = Stars(2,i) + Stars(3,i) 'move it IF stars(2,i) > 255 THEN 'check for camera LENS stars(2,i) = 0 'ReInit Z value END IF ox = stars(4,i) oy = stars(5,i) if ox>-1 and ox-1 and oy0 then 'Projection formula x = XMID + (LENS * sx / Distance) y = YMID - (LENS * sy / Distance) Stars(4,i) = x Stars(5,i) = y ELSE 'do nothing 'you wouldn't wan't to 'divide by 0 would ya? :*) END IF if x>-1 and x-1 and y