'=========================================================================== ' Subject: STAR FIELD 3D Date: 01-07-98 (19:26) ' Author: Nick Kochakian Code: QB, QBasic, PDS ' Origin: NickK@worldnet.att.net Packet: GRAPHICS.ABC '=========================================================================== DECLARE SUB draw.stars () 'Star Field 3D ' 'verison 1.0 ' 'This is my first GOOD and FAST 3D star field. (Compared to SField.bas) 'Please adjust the settings before running the program. ' 'This program currently has 3 layers of stars. But that's going to change 'to 3 to 10 layers by Star Field 3D ver. 2.0 ' '(If you didn't change the settings yet they are currently set for: 'a P60... Look at the chart below...) ' 'High res mode looks impressive with 500 stars. :) ' 'Have fun! DEFINT A-Z RANDOMIZE TIMER 'Computer speed chart: (values recommended for best performance) '286, 386 -> stars = 50 to 150, res low '486 -> stars = 100 to 200 'Pentium -> stars = 100 to 500 res$ = "low" 'res$ values: 'low 'high video$ = "vga" 'video$ values: 'vga IF res$ = "low" AND video$ = "vga" THEN scr.mode = 13: GOTO ok.ok: IF res$ = "high" AND video$ = "vga" THEN scr.mode = 12: GOTO ok.ok: PRINT "That's not a valid configuration!": END ok.ok: SCREEN scr.mode DIM SHARED stars stars = 500 DIM SHARED x(stars) DIM SHARED y(stars) DIM SHARED z(stars) DIM SHARED c(stars) 'z ===> 1 - 2 - 3 ' far --------- near FOR i = 1 TO stars IF scr.mode = 13 THEN x(i) = INT(RND * 320) + 1 y(i) = INT(RND * 200) + 1 z(i) = INT(RND * 3) + 1 END IF IF scr.mode = 13 THEN IF z(i) = 1 THEN c(i) = 20 IF z(i) = 2 THEN c(i) = 25 IF z(i) = 3 THEN c(i) = 30 END IF IF scr.mode = 12 THEN x(i) = INT(RND * 640) + 1 y(i) = INT(RND * 480) + 1 z(i) = INT(RND * 3) + 1 END IF IF scr.mode = 12 THEN IF z(i) = 1 THEN c(i) = 8 IF z(i) = 2 THEN c(i) = 7 IF z(i) = 3 THEN c(i) = 15 END IF NEXT i draw.stars i = 1 move$ = "<" DO PSET (x(i), y(i)), 0 IF move$ = "<" THEN IF z(i) = 1 THEN x(i) = x(i) - .7 IF z(i) = 2 THEN x(i) = x(i) - 1.5 IF z(i) = 3 THEN x(i) = x(i) - 3 END IF PSET (x(i), y(i)), c(i) 'FOR a = 1 TO 999 'NEXT a IF x(i) < 0 THEN GOSUB re.rand.star: i = i + 1 IF i > stars THEN i = 1 LOOP UNTIL INKEY$ <> "" END re.rand.star: IF scr.mode = 13 THEN x(i) = 320 y(i) = INT(RND * 200) + 1 z(i) = INT(RND * 3) + 1 IF z(i) = 1 THEN c(i) = 20 IF z(i) = 2 THEN c(i) = 25 IF z(i) = 3 THEN c(i) = 30 END IF IF scr.mode = 12 THEN x(i) = 640 y(i) = INT(RND * 480) + 1 z(i) = INT(RND * 3) + 1 IF z(i) = 1 THEN c(i) = 8 IF z(i) = 2 THEN c(i) = 7 IF z(i) = 3 THEN c(i) = 15 END IF RETURN SUB draw.stars FOR i = 1 TO stars PSET (x(i), y(i)), c(i) NEXT i END SUB