'=========================================================================== ' Subject: FIREWORKS Date: 12-31-97 (22:37) ' Author: Kenneth Green Code: QB, QBasic, PDS ' Origin: alt.lang.basic Packet: GRAPHICS.ABC '=========================================================================== REM Fireworks By Kenneth Green REM QBasic version made on December 31, 1997. REM I decided to make a QBasic version of this program so people can REM see that it is made using a BASIC like language called ASIC 5.0. REM I only changed the lines with random statements, add GOTO statements, REM and switch the X to vertical and Y to horizontal instead of the other REM way around for the PSET statements. REM You are free to change it anyway you want to, but be careful not REM to wreck it! REM CCX is the vertical position, CY is the horizontal. REM All the variables starting with D are the directions to move. REM There are 12 seperate stars that move at one time. REM As soon as one moves off the screen, it restarts going another direction. REM You can easy change the speed just from the wait loop for tim=1 to 300 REM just change the 300 to something else. That line is easily seen between REM long lines I made for you. REM Have Fun! esc$ = CHR$(27) RANDOMIZE TIMER CCX = INT(RND * 159) + 10 RANDOMIZE TIMER CY = INT(RND * 300) + 10 RANDOMIZE TIMER FINI = INT(RND * 100) + 10 CLS SCREEN 13 PRINT " Fireworks (QBasic Version)" PRINT PRINT " By Kenneth Green" PRINT " ken@onramp113.org" PRINT PRINT "This program simulates fireworks." PRINT "It randomly starts the explosions" PRINT "and also puts them on a random place." PRINT "This program is Public Domain and may" PRINT "be copied for free." PRINT : PRINT PRINT "To stop the program, press Esc key." PRINT PRINT "Press enter to start."; INPUT st$ CLS x = CCX y = CY xx = CCX + 1 yy = CY xx2 = CCX + 1 yy2 = CY + 1 xx3 = CCX yy3 = CY + 1 x2 = CCX y2 = CY xxx = CCX + 1 yyy = CY xxx2 = CCX + 1 yyy2 = CY + 1 xxx3 = CCX yyy3 = CY + 1 x3 = CCX y3 = CY xxxx = CCX + 1 yyyy = CY xxxx2 = CCX + 1 yyyy2 = CY + 1 xxxx3 = CCX yyyy3 = CY + 1 x4 = CCX y4 = CY xxxxx = CCX + 1 yyyyy = CY xxxxx2 = CCX + 1 yyyyy2 = CY + 1 xxxxx3 = CCX yyyyy3 = ccy + 1 x5 = CCX y5 = CY x6 = CCX y6 = CY x7 = CCX y7 = CY x8 = CCX y8 = CY x9 = CCX y9 = CY x10 = CCX y10 = CY x11 = CCX y11 = CY x12 = CCX y12 = CY RANDOMIZE TIMER directions: one: RANDOMIZE TIMER CL = INT(RND * 50) + 20 RANDOMIZE TIMER D = INT(RND * 4) + 1 RANDOMIZE TIMER D24 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF two: RANDOMIZE TIMER CL2 = INT(RND * 50) + 20 RANDOMIZE TIMER D2 = INT(RND * 4) + 1 RANDOMIZE TIMER D17 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF three: RANDOMIZE TIMER CL3 = INT(RND * 50) + 20 RANDOMIZE TIMER D3 = INT(RND * 4) + 1 RANDOMIZE TIMER D18 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF four: RANDOMIZE TIMER CL4 = INT(RND * 50) + 20 RANDOMIZE TIMER D4 = INT(RND * 4) + 1 RANDOMIZE TIMER D19 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF five: RANDOMIZE TIMER CL5 = INT(RND * 50) + 20 RANDOMIZE TIMER D5 = INT(RND * 4) + 1 RANDOMIZE TIMER D20 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF six: RANDOMIZE TIMER CL6 = INT(RND * 50) + 20 RANDOMIZE TIMER D6 = INT(RND * 4) + 1 RANDOMIZE TIMER D21 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF seven: RANDOMIZE TIMER CL7 = INT(RND * 50) + 20 RANDOMIZE TIMER D7 = INT(RND * 4) + 1 RANDOMIZE TIMER D22 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF eight: RANDOMIZE TIMER CL8 = INT(RND * 50) + 20 RANDOMIZE TIMER D8 = INT(RND * 4) + 1 RANDOMIZE TIMER D23 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF nine: RANDOMIZE TIMER CL9 = INT(RND * 50) + 20 RANDOMIZE TIMER D9 = INT(RND * 4) + 1 RANDOMIZE TIMER D13 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF ten: RANDOMIZE TIMER CL10 = INT(RND * 50) + 20 RANDOMIZE TIMER D10 = INT(RND * 4) + 1 RANDOMIZE TIMER D14 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF eleven: RANDOMIZE TIMER CL11 = INT(RND * 50) + 20 RANDOMIZE TIMER D11 = INT(RND * 4) + 1 RANDOMIZE TIMER D15 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF twelve: RANDOMIZE TIMER CL12 = INT(RND * 50) + 20 RANDOMIZE TIMER D12 = INT(RND * 4) + 1 RANDOMIZE TIMER D16 = INT(RND * 4) + 1 IF tt = 1 THEN RETURN END IF begin: tt = 1 go: sta = sta + 1 IF sta > FINI THEN sta = 0 RANDOMIZE TIMER FINI = INT(RND * 100) + 100 RANDOMIZE TIMER CCX = INT(RND * 159) + 10 RANDOMIZE TIMER CY = INT(RND * 300) + 10 END IF REM -------------------------------------------------------------------- REM REM Wait Loop! Change the 300 to another number to change speed. REM FOR tim = 1 TO 300: NEXT tim REM -------------------------------------------------------------------- PSET (y, x), 0 PSET (yy, xx), 0 PSET (yy2, xx2), 0 PSET (yy3, xx3), 0 PSET (y2, x2), 0 PSET (yyy, xxx), 0 PSET (yyy2, xxx2), 0 PSET (yyy3, xxx3), 0 PSET (y3, x3), 0 PSET (yyyy, xxxx), 0 PSET (yyyy2, xxxx2), 0 PSET (yyyy3, xxxx3), 0 PSET (y4, x4), 0 PSET (yyyyy, xxxxx), 0 PSET (yyyyy2, xxxxx2), 0 PSET (yyyyy3, xxxxx3), 0 PSET (y5, x5), 0 PSET (y6, x6), 0 PSET (y7, x7), 0 PSET (y8, x8), 0 PSET (y9, x9), 0 PSET (y10, x10), 0 PSET (y11, x11), 0 PSET (y12, x12), 0 x = x + D y = y + D24 xx = xx + D yy = yy + D24 xx2 = xx2 + D yy2 = yy2 + D24 xx3 = xx3 + D yy3 = yy3 + D24 x2 = x2 - D2 y2 = y2 + D17 xxx = xxx - D2 yyy = yyy + D17 xxx2 = xxx2 - D2 yyy2 = yyy2 + D17 xxx3 = xxx3 - D2 yyy3 = yyy3 + D17 x3 = x3 - D3 y3 = y3 - D18 xxxx = xxxx - D3 yyyy = yyyy - D18 xxxx2 = xxxx2 - D3 yyyy2 = yyyy2 - D18 xxxx3 = xxxx3 - D3 yyyy3 = yyyy3 - D18 x4 = x4 + D4 y4 = y4 - D19 xxxxx = xxxxx + D4 yyyyy = yyyyy - D19 xxxxx2 = xxxxx2 + D4 yyyyy2 = yyyyy2 - D19 xxxxx3 = xxxxx3 + D4 yyyyy3 = yyyyy3 - D19 x5 = x5 + D5 y5 = y5 + D20 x6 = x6 - D6 y6 = y6 + D21 x7 = x7 - D7 y7 = y7 - D22 x8 = x8 + D8 y8 = y8 - D23 x9 = x9 - D9 y9 = y9 + D13 x10 = x10 + D10 y10 = y10 - D14 x11 = x11 - D11 y11 = y11 - D15 x12 = x12 + D12 y12 = y12 + D16 PSET (y, x), CL PSET (yy, xx), CL PSET (yy2, xx2), CL PSET (yy3, xx3), CL PSET (y2, x2), CL2 PSET (yyy, xxx), CL2 PSET (yyy2, xxx2), CL2 PSET (yyy3, xxx3), CL2 PSET (y3, x3), CL3 PSET (yyyy, xxxx), CL3 PSET (yyyy2, xxxx2), CL3 PSET (yyyy3, xxxx3), CL3 PSET (y4, x4), CL4 PSET (yyyyy, xxxxx), CL4 PSET (yyyyy2, xxxxx2), CL4 PSET (yyyyy3, xxxxx3), CL4 PSET (y5, x5), CL5 PSET (y6, x6), CL6 PSET (y7, x7), CL7 PSET (y8, x8), CL8 PSET (y9, x9), CL9 PSET (y10, x10), CL10 PSET (y11, x11), CL11 PSET (y12, x12), CL12 IF x > 198 THEN PSET (y, x), 0 PSET (yy, xx), 0 PSET (yy2, xx2), 0 PSET (yy3, xx3), 0 x = CCX y = CY xx = x + 1 yy = y xx2 = xx yy2 = y + 1 xx3 = x yy3 = y + 1 GOSUB one: END IF IF x6 > 198 THEN PSET (y6, x6), 0 x6 = CCX y6 = CY GOSUB six: END IF IF y > 320 THEN PSET (y, x), 0 PSET (yy, xx), 0 PSET (yy2, xx2), 0 PSET (yy3, xx3), 0 x = CCX y = CY xx = x + 1 yy = y xx2 = x + 1 yy2 = y + 1 xx3 = x yy3 = y + 1 GOSUB one: END IF IF x2 > 198 THEN PSET (y2, x2), 0 PSET (yyy, xxx), 0 PSET (yyy2, xxx2), 0 PSET (yyy3, xxx3), 0 x2 = CCX y2 = CY xxx = x2 + 1 yyy = y2 xxx2 = x2 + 1 yyy2 = y2 + 1 xxx3 = x2 yyy3 = y2 + 1 GOSUB two: END IF IF y2 > 320 THEN PSET (y2, x2), 0 PSET (yyy, xxx), 0 PSET (yyy2, xxx2), 0 PSET (yyy3, xxx3), 0 x2 = CCX y2 = CY xxx = x2 + 1 yyy = y2 xxx2 = x2 + 1 yyy2 = y2 + 1 xxx3 = x2 yyy3 = y2 + 1 GOSUB two: END IF IF x3 > 198 THEN PSET (y3, x3), 0 PSET (yyyy, xxxx), 0 PSET (yyyy2, xxxx2), 0 PSET (yyyy3, xxxx3), 0 x3 = CCX y3 = CY xxxx = x3 + 1 yyyy = y3 xxxx2 = x3 + 1 yyyy2 = y3 + 1 xxxx3 = x3 yyyy3 = y3 + 1 GOSUB three: END IF IF y3 > 320 THEN PSET (y3, x3), 0 PSET (yyyy, xxxx), 0 PSET (yyyy2, xxxx2), 0 PSET (yyyy3, xxxx3), 0 x3 = CCX y3 = CY xxxx = x3 + 1 yyyy = y3 xxxx2 = x3 + 1 yyyy2 = y3 + 1 xxxx3 = x3 yyyy3 = y3 + 1 GOSUB three: END IF IF x4 > 198 THEN PSET (y4, x4), 0 PSET (yyyyy, xxxxx), 0 PSET (yyyyy2, xxxxx2), 0 PSET (yyyyy3, xxxxx3), 0 x4 = CCX y4 = CY xxxxx = x4 + 1 yyyyy = y4 xxxxx2 = x4 + 1 yyyyy2 = y4 + 1 xxxxx3 = x4 yyyyy3 = y4 + 1 GOSUB four: END IF IF y4 > 320 THEN PSET (y4, x4), 0 PSET (yyyyy, xxxxx), 0 PSET (yyyyy2, xxxxx2), 0 PSET (yyyyy3, xxxxx3), 0 x4 = CCX y4 = CY xxxxx = x4 + 1 yyyyy = y4 xxxxx2 = x4 + 1 yyyyy2 = y4 + 1 xxxxx3 = x4 yyyyy3 = y4 + 1 GOSUB four: END IF IF x5 > 198 THEN PSET (y5, x5), 0 x5 = CCX y5 = CY GOSUB five: END IF IF y5 > 320 THEN PSET (y5, x5), 0 x5 = CCX y5 = CY GOSUB five: END IF IF y6 > 320 THEN PSET (y6, x6), 0 x6 = CCX y6 = CY GOSUB six: END IF IF x7 > 198 THEN PSET (y7, x7), 0 x7 = CCX y7 = CY GOSUB seven: END IF IF y7 > 320 THEN PSET (y7, x7), 0 x7 = CCX y7 = CY GOSUB seven: END IF IF x8 > 198 THEN PSET (y8, x8), 0 x8 = CCX y8 = CY GOSUB eight: END IF IF y8 > 320 THEN PSET (y8, x8), 0 x8 = CCX y8 = CY GOSUB eight: END IF IF x9 > 198 THEN PSET (y9, x9), 0 x9 = CCX y9 = CY GOSUB nine: END IF IF y9 > 320 THEN PSET (y9, x9), 0 x9 = CCX y9 = CY GOSUB nine: END IF IF x10 > 198 THEN PSET (y10, x10), 0 x10 = CCX y10 = CY GOSUB ten: END IF IF y10 > 320 THEN PSET (y10, x10), 0 x10 = CCX y10 = CY GOSUB ten: END IF IF x11 > 198 THEN PSET (y11, x11), 0 x11 = CCX y11 = CY GOSUB eleven: END IF IF y11 > 320 THEN PSET (y11, x11), 0 x11 = CCX y11 = CY GOSUB eleven: END IF IF x12 > 198 THEN PSET (y12, x12), 0 x12 = CCX y12 = CY GOSUB twelve: END IF IF y12 > 320 THEN PSET (y12, x12), 0 x12 = CCX y12 = CY GOSUB twelve: END IF IF x < 5 THEN PSET (y, x), 0 PSET (yy, xx), 0 PSET (yy2, xx2), 0 PSET (yy3, xx3), 0 x = CCX y = CY xx = x + 1 yy = y xx2 = x + 1 yy2 = y + 1 xx3 = x yy3 = y + 1 GOSUB one: END IF IF x6 < 5 THEN PSET (y6, x6), 0 x6 = CCX y6 = CY GOSUB six: END IF IF y < 5 THEN PSET (y, x), 0 PSET (yy, xx), 0 PSET (yy2, xx2), 0 PSET (yy3, xx3), 0 x = CCX y = CY xx = x + 1 yy = y xx2 = x + 1 yy2 = y + 1 xx3 = x yy3 = y + 1 GOSUB one: END IF IF x2 < 5 THEN PSET (y2, x2), 0 PSET (yyy, xxx), 0 PSET (yyy2, xxx2), 0 PSET (yyy3, xxx3), 0 x2 = CCX y2 = CY xxx = x2 + 1 yyy = y2 xxx2 = x2 + 1 yyy2 = y2 + 1 xxx3 = x2 yyy3 = y2 + 1 GOSUB two: END IF IF y2 < 5 THEN PSET (y2, x2), 0 PSET (yyy, xxx), 0 PSET (yyy2, xxx2), 0 PSET (yyy3, xxx3), 0 x2 = CCX y2 = CY xxx = x2 + 1 yyy = y2 xxx2 = x2 + 1 yyy2 = y2 + 1 xxx3 = x2 yyy3 = y2 + 1 GOSUB two: END IF IF x3 < 5 THEN PSET (y3, x3), 0 PSET (yyyy, xxxx), 0 PSET (yyyy2, xxxx2), 0 PSET (yyyy3, xxxx3), 0 x3 = CCX y3 = CY xxxx = x3 + 1 yyyy = y3 xxxx2 = x3 + 1 yyyy2 = y3 + 1 xxxx3 = x3 yyyy3 = y3 + 1 GOSUB three: END IF IF y3 < 5 THEN PSET (y3, x3), 0 PSET (yyyy, xxxx), 0 PSET (yyyy2, xxxx2), 0 PSET (yyyy3, xxxx3), 0 x3 = CCX y3 = CY xxxx = x3 + 1 yyyy = y3 xxxx2 = x3 + 1 yyyy2 = y3 + 1 xxxx3 = x3 yyyy3 = y3 + 1 GOSUB three: END IF IF x4 < 5 THEN PSET (y4, x4), 0 PSET (yyyyy, xxxxx), 0 PSET (yyyyy2, xxxxx2), 0 PSET (yyyyy3, xxxxx3), 0 x4 = CCX y4 = CY xxxxx = x4 + 1 yyyyy = y4 xxxxx2 = x4 + 1 yyyyy2 = y4 + 1 xxxxx3 = x4 yyyyy3 = y4 + 1 GOSUB four: END IF IF y4 < 5 THEN PSET (y4, x4), 0 PSET (yyyyy, xxxxx), 0 PSET (yyyyy2, xxxxx2), 0 PSET (yyyyy3, xxxxx3), 0 x4 = CCX y4 = CY xxxxx = x4 + 1 yyyyy = y4 xxxxx2 = x4 + 1 yyyyy2 = y4 + 1 xxxxx3 = x4 yyyyy3 = y4 + 1 GOSUB four: END IF IF x5 < 5 THEN PSET (y5, x5), 0 x5 = CCX y5 = CY GOSUB five: END IF IF y5 < 5 THEN PSET (y5, x5), 0 x5 = CCX y5 = CY GOSUB five: END IF IF y6 < 5 THEN PSET (y6, x6), 0 x6 = CCX y6 = CY GOSUB six: END IF IF x7 < 5 THEN PSET (y7, x7), 0 x7 = CCX y7 = CY GOSUB seven: END IF IF y7 < 5 THEN PSET (y7, x7), 0 x7 = CCX y7 = CY GOSUB seven: END IF IF x8 < 5 THEN PSET (y8, x8), 0 x8 = CCX y8 = CY GOSUB eight: END IF IF y8 < 5 THEN PSET (y8, x8), 0 x8 = CCX y8 = CY GOSUB eight: END IF IF x9 < 5 THEN PSET (y9, x9), 0 x9 = CCX y9 = CY GOSUB nine: END IF IF y9 < 5 THEN PSET (y9, x9), 0 x9 = CCX y9 = CY GOSUB nine: END IF IF x10 < 5 THEN PSET (y10, x10), 0 x10 = CCX y10 = CY GOSUB ten: END IF IF y10 < 5 THEN PSET (y10, x10), 0 x10 = CCX y10 = CY GOSUB ten: END IF IF x11 < 5 THEN PSET (y11, x11), 0 x11 = CCX y11 = CY GOSUB eleven: END IF IF y11 < 5 THEN PSET (y11, x11), 0 x11 = CCX y11 = CY GOSUB eleven: END IF IF x12 < 5 THEN PSET (y12, x12), 0 x12 = CCX y12 = CY GOSUB twelve: END IF IF y12 < 5 THEN PSET (y12, x12), 0 x12 = CCX y12 = CY GOSUB twelve: END IF a$ = INKEY$ IF a$ = esc$ THEN GOTO done: GOTO begin: done: SCREEN 0 WIDTH 80 CLS END