Bomb Run II Written by mjhayes@cs.buffalo.edu August 28, 1998 This program uses the graphics from "Triple Action." It was written as a follow-up to "Bomb Run I" and was inspired by the game "Bomber." Several features which I was saving for this program wouldn't fit, so I will add those features to Bomb Run I instead. The object of this game is to destroy buildings by dropping bombs on them in order to crash-land safely. Use any action button on the left hand controller to drop a bomb. Points are earned for bombing buildings and just for surviving. If you land safely, another level begins with taller buildings. If you hit a building or survive ten levels, then the final score and level are displayed. Try again to beat your best score. 10 FM(0)=0 ; Two numbers are displayed on one line, in regular notation, with 0 places to the right of the decimal point. 20 FM(4)=4 ; All text will be displayed in dark green. 30 M=3 ; The explosion sprites have four frames of animation. 40 N=12 50 FOR O=0 TO 5 60 CALL GRAB ; Create the explosion sprites. 70 SQ(O)=9 ; Animate the explosions. 80 NEXT O 90 M=0 ; No animation for the bomb. 100 N=11 110 CALL GRAB ; Create the bomb. 120 D=2 ; The plane is a hi-res sprite. 130 N=16 140 O=7 150 CALL GRAB ; Create the plane. 160 CO(7)=1 ; Make it blue. 170 FOR O=0 TO 7 180 VS(O)=-1 ; Make all sprites invisible. 190 NEXT O 200 SET A$="PRESS ANY ACTION" ; Pre-define the longer text to save memory. 210 SET B$="BUTTON TO CONTINUE." RUN 10 CLR 20 PRIN"BOMB RUN II" 30 PRIN"BY MIKE HAYES" 40 PRIN"DOLM: JULY 3, 1998 " ; Display the credits. 50 FOR O=0 TO 7 60 VS(O)=-1 ; Make all sprites invisible. 70 XS(O)=0 80 YS(O)=0 ; Stop all sprites. 90 NEXT O 100 GSUB 890 ; Subroutine to wait for an action key to be pressed. 110 G=0 ; Reset score. 120 FOR B=1 TO 10 ; There are ten levels.{ 130 CLR 140 FOR J=0 TO 19 ; Generate the buildings.{ 150 Q=RN(0)*B/10 ; Each building is 1..10 blocks in height. The higher the level, the taller the buildings will be. 160 FOR K=0 TO 9 170 IF(Q5)GOTO 770 ; Did the plane crash? 350 IF(VS(6)=-1)GOTO 580 ; Is the bomb visible? If it is{ 360 YP(6)=YP(6)+8 ; Lower the bomb one square. 370 IF(YP(6)>96)VS(6)=-1 ; Did the bomb hit the ground? 380 Q=YP(6)*2.5+XP(6)/8 390 Q=Q-21 ; Calculate the block the bomb is currently occupying. 400 IF(BK(Q)=5)GOTO 660 ; Did the bomb hit a building? If it did{ 410 G=G+3 ; Earn three points. 420 C=0 430 P=0 440 CALL ENVN ; Make a sound. 450 VS(6)=-1 ; Make the bomb disappear. 460 FOR K=0 TO 5 470 CO(K)=BK(Q)/16+5.5 ; Make the debris (explosion sprites) the same color as the building hit. 480 XP(K)=XP(6) 490 YP(K)=YP(6)+K*3 ; Put the debris in position. 500 VS(K)=1 ; Make the debris visible. 510 IF(K>2)GOTO 540 520 R=Q+K*20 ; Calculate the building blocks to erase. 530 IF(R<240)BK(R)=5 ; Erase the building blocks. 540 NEXT K 550 FOR K=0 TO 5 560 VS(K)=-1 ; Make the debris disappear.} 570 NEXT K ; } 580 CALL HAND ; Poll the left hand controller. 590 IF(A=0)GOTO 660 ; Is an action key being pressed? If it is{ 600 C=1 610 P=9 620 CALL ENVN ; Make a sound. 630 XP(6)=XP(7) 640 YP(6)=YP(7) ; Put the bomb in position. 650 VS(6)=1 ; Make the bomb visible.} 660 G=G+1 ; Score a point, just for staying alive. 670 IF(XP(7)<160)GOTO 700 ; Did the plane go off the right side of the screen? If it did{ 680 XP(7)=0 ; Move it all the way to the left... 690 YP(7)=YP(7)+8 ; and down one block.} 700 XP(7)=XP(7)+8 ; Move the plane right one block. 710 NEXT J ; End of level. 720 CALL HUSH 730 PRIN"LEVEL AND SCORE:",B,G ; Display current level and score. 740 GSUB 890 ; Wait for action button to be pressed. 750 NEXT B ; } 760 GOTO 870 770 FOR C=0 TO 5 780 CO(C)=C/2*4+2 790 XP(C)=XP(7) 800 YP(C)=YP(7) ; Put explosion sprites in position. 810 XV(C)=RN(C)-49 820 YV(C)=RN(C)-49 ; Shoot explosion sprites in random directions. 830 VS(C)=1 ; Make explosion sprites visible. 840 P=C*6 850 CALL ENVN ; Make crashing noise. 860 NEXT C 870 PRIN"FINAL LEVEL, SCORE:",B,G 880 GOTO 50 ; New game. 890 PUT A$ ; Subroutine{ 900 PUT B$ ; Display text. 910 CALL HAND 920 IF(A=0)GOTO 910 ; Wait for action key to be pressed. 930 RET ; }