'=========================================================================== ' Subject: DIRECTIONAL STARFIELD Date: 01-20-97 (00:00) ' Author: Nick Kochakian Code: QB, QBasic, PDS ' Origin: NickK@worldnet.att.net Packet: GRAPHICS.ABC '=========================================================================== '---------------------------------------------------------------------------- 'Program name: SFIELD the star field 'Verison: verison 1.0 ' 'Date made: 1/20/97, 1997 ' 'Author: - Nick Kochakian - ' 'Comments: If you would like to use this program / routines please give 'me some credit... Somewhere... ' 'E-mail: nickK@worldnet.att.net '---------------------------------------------------------------------------- RANDOMIZE TIMER SCREEN 13 WAY = 1 'The way to scroll the star filed '1 - left '2 - diagonal right / down '3 - right '4 - up '5 - diagonal left / up '6 - diagonal down / left '7 - diagonal right / up '8 - down 'Note that ways 2-8 will ONLY WORK if DISTCHK$="N" DISTCHK$ = "Y" 'Distance check 'Y - is yes 'N - is no 'Note that distance check can only be used with way 1... For now... STARS = 100 'Amount of stars at one time SX = STARS 'Star X SY = STARS 'Star Y SC = STARS 'Star Color SM = STARS 'Star speed mover DIM X(SX) DIM Y(SY) DIM C(SC) DIM S(SM) SX = 1 SY = 1 SC = 1 SM = 1 'Place the stars for the first time FOR I = 1 TO STARS X(SX) = INT(RND * 300) + 1 Y(SY) = INT(RND * 200) + 1 C(SC) = INT(RND * 30) + 1 IF C(SC) = 16 THEN S(SM) = 1 IF C(SC) = 17 THEN S(SM) = 1.5 IF C(SC) = 18 THEN S(SM) = 2 IF C(SC) = 19 THEN S(SM) = 2.5 IF C(SC) = 20 THEN S(SM) = 3 IF C(SC) >= 21 THEN S(SM) = 3.5 IF C(SC) >= 29 THEN S(SM) = 4 IF C(SC) < 16 THEN C(SC) = 16 PSET (X(SX), Y(SY)), C(SC) SX = SX + 1 SY = SY + 1 SC = SC + 1 NEXT I SX = 1 SY = 1 SC = 1 SM = 1 'The main loop DO PSET (X(SX), Y(SY)), 0 IF UCASE$(DISTCHK$) = "Y" AND WAY = 1 THEN IF C(SC) <= 18 THEN X(SX) = X(SX) - .25 IF C(SC) = 19 THEN X(SX) = X(SX) - .5 IF C(SC) = 20 THEN X(SX) = X(SX) - 1.25 IF C(SC) = 21 THEN X(SX) = X(SX) - 1.5 IF C(SC) = 22 THEN X(SX) = X(SX) - 1 IF C(SC) = 23 THEN X(SX) = X(SX) - 2.25 IF C(SC) = 24 THEN X(SX) = X(SX) - 2.5 IF C(SC) = 25 THEN X(SX) = X(SX) - 2 IF C(SC) = 26 THEN X(SX) = X(SX) - 3.25 IF C(SC) = 27 THEN X(SX) = X(SX) - 3.5 IF C(SC) = 28 THEN X(SX) = X(SX) - 3 IF C(SC) = 29 THEN X(SX) = X(SX) - 4.25 IF C(SC) = 30 THEN X(SX) = X(SX) - 4 END IF IF UCASE$(DISTCHK$) = "N" AND WAY = 1 THEN X(SX) = X(SX) - 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 2 THEN Y(SY) = Y(SY) + 1: X(SX) = X(SX) + 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 3 THEN X(SX) = X(SX) + 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 4 THEN Y(SY) = Y(SY) - 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 5 THEN Y(SY) = Y(SY) - 1: X(SX) = X(SX) - 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 6 THEN Y(SY) = Y(SY) + 1: X(SX) = X(SX) - 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 7 THEN Y(SY) = Y(SY) - 1: X(SX) = X(SX) + 1 IF UCASE$(DISTCHK$) = "N" AND WAY = 8 THEN Y(SY) = Y(SY) + 1 PSET (X(SX), Y(SY)), C(SC) IF X(SX) < 1 THEN PSET (X(SX), Y(SY)), 0: GOSUB RERAND: IF Y(SY) > 200 THEN PSET (X(SX), Y(SY)), 0: GOSUB RERAND: IF X(SX) > 300 THEN PSET (X(SX), Y(SY)), 0: GOSUB RERAND: IF Y(SY) < 1 THEN PSET (X(SX), Y(SY)), 0: GOSUB RERAND: SX = SX + 1 SY = SY + 1 SM = SM + 1 SC = SC + 1 IF SX > STARS THEN SX = 1 IF SY > STARS THEN SY = 1 IF SM > STARS THEN SM = 1 IF SC > STARS THEN SC = 1 LOOP UNTIL INKEY$ <> "" END RERAND: 'Re-Randomize stars RANDOMIZE TIMER IF X(SX) < 1 THEN X(SX) = 1 X(SX) = INT(RND * 300) + 1 Y(SY) = INT(RND * 200) + 1 C(SC) = INT(RND * 30) + 1 IF C(SC) = 16 THEN S(SM) = 1 IF C(SC) = 17 THEN S(SM) = 1.5 IF C(SC) = 18 THEN S(SM) = 2 IF C(SC) = 19 THEN S(SM) = 2.5 IF C(SC) = 20 THEN S(SM) = 3 IF C(SC) >= 21 THEN S(SM) = 3.5 IF C(SC) >= 29 THEN S(SM) = 4 IF C(SC) < 16 THEN C(SC) = 16 RETURN