'=========================================================================== ' Subject: STAR/CREDIT SCROLLER Date: 08/02/95 (00:00:00) ' Author: The ABC Programmer Code: QB, QBasic, PDS ' Keys: STAR,CREDIT,SCROLLER Packet: GRAPHICS.ABC '=========================================================================== '============================================================== ' Star/Credit Scroller by William Yu 1995 ' Simple use of page flipping to create a star trek effect '============================================================== DEFINT A-Z DECLARE SUB ReGenerate (X) DECLARE SUB CenterPrint (Y, MSG$) DECLARE SUB ChangeMessage (Message) SCREEN 7, 0, 0, 0 DIM SHARED Stars(100) AS INTEGER DIM SHARED StarColor(100) AS INTEGER DIM SHARED MSG$ X = 0 DO X = X + 1 RANDOMIZE TIMER I = INT(RND * 320) + 1 C = INT(RND * 3) + 1 IF C = 1 THEN C = 7 IF C = 2 THEN C = 8 IF C = 3 THEN C = 15 Stars(X) = I StarColor(X) = C LOOP UNTIL X = 100 LINE (0, 45)-(320, 50), 8, BF LINE (0, 46)-(320, 49), 7, BF LINE (0, 47)-(320, 48), 15, BF LINE (0, 156)-(320, 151), 8, BF LINE (0, 155)-(320, 152), 7, BF LINE (0, 154)-(320, 153), 15, BF CIRCLE (160, 100), 10, 10 PAINT (160, 100), 14, 10 XCor = 160: Ycor = 100 Y = 19 Message = 1 ChangeMessage Message DO V$ = INKEY$ IF V$ = CHR$(0) + "P" THEN Ycor = Ycor + 2 IF V$ = CHR$(0) + "H" THEN Ycor = Ycor - 2 IF V$ = CHR$(0) + "M" THEN XCor = XCor + 3 IF V$ = CHR$(0) + "K" THEN XCor = XCor - 3 IF Ycor > 140 THEN Ycor = 140 ' Disable this for UnderLap IF Ycor < 60 THEN Ycor = 60 ' Disable this for OverLap FOR X = 1 TO 100 PSET (Stars(X), X + 50), StarColor(X) NEXT PCOPY 0, 1 ' Copies Page 0 to Page 1 SCREEN 7, 0, 1, 0 ' Write to Page 1 (Hidden) LINE (0, 45)-(320, 156), 0, BF ' Use CLS for Over/UnderLap FOR X = 1 TO 100 Stars(X) = Stars(X) - 1 IF Stars(X) <= 0 THEN ReGenerate X NEXT X COLOR 11: CenterPrint Y, MSG$ LINE (0, 45)-(320, 50), 8, BF ' This is an overlap LINE (0, 46)-(320, 49), 7, BF LINE (0, 47)-(320, 48), 15, BF CIRCLE (XCor, Ycor), 10, 10 ' Move the Circle around PAINT (XCor, Ycor), 14, 10 LINE (0, 156)-(320, 151), 8, BF ' This is an underlap LINE (0, 155)-(320, 152), 7, BF LINE (0, 154)-(320, 153), 15, BF PCOPY 1, 0 ' Copy Page 1 (Hidden) to Page 0 SCREEN 7, 0, 0, 0 ' Switch back to visual page Y = Y - 1 IF Y = 7 THEN Y = 19: Message = Message + 1: ChangeMessage Message LOOP UNTIL V$ = CHR$(27) SUB CenterPrint (Y, MSG$) Row! = 20 - (LEN((MSG$)) / 2) + .5 LOCATE Y, Row!: PRINT MSG$ END SUB SUB ChangeMessage (Message) IF Message = 7 THEN Message = 1 IF Message = 1 THEN MSG$ = "Credit Star Scroller By William Yu" IF Message = 2 THEN MSG$ = "This Is A Cheap Page Flipping Technique" IF Message = 3 THEN MSG$ = "You Can Slow This Down By Adding Delays" IF Message = 4 THEN MSG$ = "Modify This Code As You Wish" IF Message = 5 THEN MSG$ = "USE Arrow Keys To Move The Circle" IF Message = 6 THEN MSG$ = "Enjoy This Demo, L8r!" END SUB SUB ReGenerate (X) RANDOMIZE TIMER I = INT((350 - 320 + 1) * RND + 320) C = INT(RND * 3) + 1 IF C = 1 THEN C = 7 IF C = 2 THEN C = 8 IF C = 3 THEN C = 15 Stars(X) = I StarColor(X) = C END SUB