DECLARE SUB troopsupdate () DECLARE SUB bulletclear () DECLARE SUB intro () DECLARE SUB teletype (text$, Delay!) DECLARE SUB numbers () DECLARE SUB dissolve () DECLARE SUB codes (h$) DECLARE SUB win () DECLARE SUB nextlevel () DECLARE SUB mainmenu () DECLARE SUB death () DECLARE SUB bulletupdate () DECLARE SUB badbulletupdate () DECLARE SUB drawbaddie (bx%, er%) DECLARE SUB drawstructs () DECLARE SUB structdef () DECLARE SUB xyupdate () COMMON SHARED x%, y%, badmove%, badshots%, level%, codesact%, codeson%, oftenshoot%, mmloop%, airvisc%, points!, troopsoften% DECLARE SUB drawyou (er%, tpe%) troopsoften% = 400 airvisc% = 20 oftenshoot% = 45 level% = 1 badmove% = 2 speedofgame% = 1000 health% = 100 badshots% = oftenshoot% - (level% * 2) x% = 320 y% = 150 DIM SHARED troops(10, 2) DIM SHARED bullet(100, 4) DIM SHARED badbullet(50, 4) DIM SHARED speed(2) '1=X Speed 2=Y Speed DIM SHARED structs(20, 4) '1=X 2=Height 3=Width 4=Health CALL intro CALL structdef CALL mainmenu SCREEN 9 CLS COLOR 15, 1 DO LOCATE 1, 1 PRINT "LEVEL: "; level%; " POINTS: "; points! LINE (0, 300)-(640, 400), 2, BF CALL drawstructs CALL drawyou(0, 1) DO h$ = INKEY$ mloop% = mloop% + 1 IF mloop% = speedofgame% THEN codesact% = codesact% - 1 mmloop% = mmloop% + 1 IF codesact% < 0 THEN codesact% = 0 mloop% = 0 EXIT DO END IF LOOP UNTIL h$ <> "" CALL drawyou(1, 1) IF codeson% = 1 THEN CALL codes(h$) IF h$ = " " THEN FOR i% = 1 TO 100 IF bullet(i%, 1) = -100 AND bullet(i%, 2) = -100 THEN SOUND (300), .1 bullet(i%, 1) = x% bullet(i%, 2) = y% + 10 bullet(i%, 3) = speed(1) bullet(i%, 4) = 2 EXIT FOR END IF NEXT i% END IF IF MID$(h$, 2, 1) = "H" THEN speed(2) = speed(2) - 1 IF MID$(h$, 2, 1) = "P" THEN speed(2) = speed(2) + 1 IF MID$(h$, 2, 1) = "K" THEN speed(1) = speed(1) - 1 IF MID$(h$, 2, 1) = "M" THEN speed(1) = speed(1) + 1 CALL badbulletupdate CALL bulletupdate CALL xyupdate CALL troopsupdate LOOP UNTIL h$ = "x" SUB badbulletupdate FOR i% = 1 TO 50 IF badbullet(i%, 1) <> -100 AND badbullet(i%, 2) <> -100 THEN CIRCLE (badbullet(i%, 1), badbullet(i%, 2)), 3, 0 CIRCLE (badbullet(i%, 1), badbullet(i%, 2)), 1, 0 badbullet(i%, 1) = badbullet(i%, 1) + badbullet(i%, 3) badbullet(i%, 2) = badbullet(i%, 2) + badbullet(i%, 4) CIRCLE (badbullet(i%, 1), badbullet(i%, 2)), 3, 13 CIRCLE (badbullet(i%, 1), badbullet(i%, 2)), 1, 13 IF badbullet(i%, 1) < 0 OR badbullet(i%, 1) > 640 OR badbullet(i%, 2) < 0 THEN badbullet(i%, 1) = -100 badbullet(i%, 2) = -100 END IF IF badbullet(i%, 1) >= x% - 10 AND badbullet(i%, 1) <= x% + 10 THEN IF badbullet(i%, 2) >= y% - 5 AND badbullet(i%, 2) <= y% + 5 THEN CALL death END IF END IF END IF NEXT i% END SUB SUB bulletclear FOR i% = 1 TO 100 CIRCLE (bullet(i%, 1), bullet(i%, 2)), 3, 0 bullet(i%, 1) = -100 bullet(i%, 2) = -100 NEXT i% CALL bulletupdate END SUB SUB bulletupdate FOR i% = 1 TO 100 IF bullet(i%, 1) <> -100 AND bullet(i%, 2) <> -100 THEN CIRCLE (bullet(i%, 1), bullet(i%, 2)), 3, 0 bullet(i%, 1) = bullet(i%, 1) + bullet(i%, 3) bullet(i%, 2) = bullet(i%, 2) + bullet(i%, 4) CIRCLE (bullet(i%, 1), bullet(i%, 2)), 3, 15 'IF bullet(i%, 1) < 0 OR bullet(i%, 1) > 640 OR bullet(i%, 2) < 0 THEN 'bullet(i%, 1) = -100 'bullet(i%, 2) = -100 'END IF IF bullet(i%, 2) < 0 THEN bullet(i%, 1) = -100 bullet(i%, 2) = -100 END IF IF bullet(i%, 1) < 0 THEN bullet(i%, 1) = 639 IF bullet(i%, 1) > 640 THEN bullet(i%, 1) = 1 IF bullet(i%, 2) > 300 THEN FOR g% = 1 TO 20 IF structs(g%, 1) <> 0 AND bullet(i%, 1) >= structs(g%, 1) - 5 AND bullet(i%, 1) <= structs(g%, 1) + 5 THEN points! = points! + 100 structs(g%, 1) = 0 FOR m% = 1 TO 20 SOUND (100 + i%), .1 CIRCLE (bullet(i%, 1) - 1, bullet(i%, 2)), m%, 14 CIRCLE (bullet(i%, 1), bullet(i%, 2)), m%, 4 CIRCLE (bullet(i%, 1) + 1, bullet(i%, 2)), m%, 14 NEXT m% END IF NEXT g% FOR u% = 1 TO 10 IF bullet(i%, 1) >= troops(u%, 1) - 4 AND bullet(i%, 1) <= troops(u%, 1) + 4 THEN troops(u%, 1) = -100 points! = points! + (5 * level%) FOR k% = 1 TO 25 RANDOMIZE TIMER j% = INT(RND * 9) - 5 RANDOMIZE TIMER t% = INT(RND * 10) + 1 PSET (bullet(i%, 1) + j%, 290 - t%), 12 NEXT k% SOUND (500), .5 END IF NEXT u% FOR g% = 1 TO 10 SOUND (100 + i%), .1 CIRCLE (bullet(i%, 1), bullet(i%, 2)), g%, 4 NEXT g% bullet(i%, 1) = -100 bullet(i%, 2) = -100 END IF END IF NEXT i% END SUB SUB codes (h$) IF h$ = "_" THEN codesact% = 20 IF codesact% > 0 THEN IF h$ = "1" THEN LOCATE 2, 1 PRINT "LEAD WALL! " CALL bulletclear FOR i% = 1 TO 50 RANDOMIZE TIMER u% = INT(RND * 5) - 3 bullet(i%, 1) = x% - 25 + i% bullet(i%, 2) = y% + u% bullet(i%, 3) = 0 bullet(i%, 4) = 15 NEXT i% END IF IF h$ = "2" THEN LOCATE 2, 1 PRINT "AXE! " CALL bulletclear FOR i% = 1 TO 50 bullet(i%, 1) = x% - 25 + i% bullet(i%, 2) = y% bullet(i%, 3) = 0 bullet(i%, 4) = i% NEXT i% END IF IF h$ = "3" THEN LOCATE 2, 1 PRINT "CONFETTI! " CALL bulletclear FOR i% = 1 TO 100 bullet(i%, 1) = x% - 12 + i% bullet(i%, 2) = y% RANDOMIZE TIMER o% = INT(RND * 6) + 1 - 3 RANDOMIZE TIMER m% = INT(RND * 3) + 1 bullet(i%, 3) = o% bullet(i%, 4) = m% NEXT i% END IF IF h$ = "4" THEN LOCATE 2, 1 PRINT "TRAIN TRACKS! " CALL bulletclear FOR i% = 1 TO 25 bullet(i%, 1) = x% - 12 + i% bullet(i%, 2) = y% bullet(i%, 3) = i% bullet(i%, 4) = 5 NEXT i% END IF IF h$ = "5" THEN LOCATE 2, 1 PRINT "STRIKE! " CALL bulletclear FOR i% = 1 TO 25 bullet(i%, 1) = m% * i% bullet(i%, 2) = 10 bullet(i%, 3) = 0 bullet(i%, 4) = 3 m% = m% + 1 NEXT i% END IF END IF END SUB SUB death FOR i% = 1 TO 300 STEP 1 CIRCLE (x%, y%), i%, 4 RANDOMIZE TIMER u% = INT(RND * 4) + 1 RANDOMIZE TIMER t% = INT(RND * 40) + 1 RANDOMIZE TIMER j% = INT(RND * 4) + 1 IF j% = 1 THEN cu% = 4 IF j% = 2 THEN cu% = 12 IF j% = 3 THEN cu% = 13 IF j% = 4 THEN cu% = 14 IF u% = 1 THEN CIRCLE (x% - t%, y%), i%, cu% IF u% = 2 THEN CIRCLE (x% + t%, y%), i%, cu% IF u% = 3 THEN CIRCLE (x%, y% - t%), i%, cu% IF u% = 4 THEN CIRCLE (x%, y% + t%), i%, cu% ll% = INT(50 + (i% / 10)) SOUND (ll%), .03 SOUND (ll% + 10), .03 SOUND (ll% - 10), .03 NEXT i% INPUT "NUCLEAR ENGINE EXPLOSION! YOU DIED! ", junk$ points% = points% - 100 IF points% < 0 THEN points% = 0 speed(1) = 0 speed(2) = 0 level% = level% - 1 IF level% < 0 THEN level% = 1 CALL structdef CALL mainmenu CLS END SUB SUB dissolve '******************************************************************************* '* use instead of cls for an interesting way to clear the screen * '******************************************************************************* DIM ScreenPos%(2000) FOR x% = 1 TO 2000 ScreenPos%(x%) = x% NEXT x% FOR x% = 1 TO 2000 SWAP ScreenPos%(x%), ScreenPos%(INT(RND(1) * 2000) + 1) NEXT x% FOR x% = 1 TO 2000 R% = ScreenPos%(x%) \ 80 + 1 IF R% = 0 THEN R% = 1 IF R% > 25 THEN R% = 25 C% = ABS(ScreenPos%(x%) - (80 * R%)) IF C% = 0 THEN C% = 1 LOCATE R%, C% PRINT CHR$(196); FOR i% = 1 TO 200 NEXT i% NEXT x% LOCATE 1, 80: PRINT " "; ' cheap temporary fix END SUB SUB drawbaddie (bx%, er%) IF er% = 0 THEN CIRCLE (bx%, 288), 3, 6 PAINT (bx%, 288), 6 LINE (bx% - 2, 290)-(bx% + 2, 300), 13, BF LINE (bx% - 4, 295)-(bx% + 4, 300), 13, BF END IF IF er% = 1 THEN CIRCLE (bx%, 288), 3, 0 PAINT (bx%, 288), 6, 0 LINE (bx% - 2, 290)-(bx% + 2, 300), 0, BF LINE (bx% - 4, 295)-(bx% + 4, 300), 0, BF END IF END SUB SUB drawstructs LINE (550, 285)-(600, 299), 6, BF LINE (25, 285)-(75, 299), 6, BF FOR i% = 1 TO 20 IF structs(i%, 1) <> 0 THEN CALL drawbaddie((structs(i%, 1)), 1) RANDOMIZE TIMER j% = INT(RND * badmove%) + 1 IF j% = 1 THEN RANDOMIZE TIMER k% = INT(RND * 5) - 2 structs(i%, 1) = structs(i%, 1) + k% END IF RANDOMIZE TIMER j% = INT(RND * badshots%) + 1 IF j% = 1 THEN FOR m% = 1 TO 25 IF badbullet(m%, 1) = -100 AND badbullet(m%, 2) = -100 THEN SOUND (500), .1 badbullet(m%, 1) = structs(i%, 1) badbullet(m%, 2) = 290 RANDOMIZE TIMER h% = INT(RND * 4) + 1 IF x% < structs(i%, 1) THEN badbullet(m%, 3) = 0 - h% IF x% > structs(i%, 1) THEN badbullet(m%, 3) = 0 + h% RANDOMIZE TIMER h% = INT(RND * 4) + 1 badbullet(m%, 4) = 0 - h% EXIT FOR END IF NEXT m% END IF IF structs(i%, 1) < 80 THEN structs(i%, 1) = 80 IF structs(i%, 1) > 540 THEN structs(i%, 1) = 540 CALL drawbaddie((structs(i%, 1)), 0) END IF NEXT i% END SUB SUB drawyou (er%, tpe%) IF er% = 0 THEN IF tpe% = 1 THEN CIRCLE (x%, y% - 3), 10, 13 PAINT (x%, y% - 3), 13 CIRCLE (x% - 9, y%), 7, 7 PAINT (x% - 9, y%), 7 CIRCLE (x% + 9, y%), 7, 7 PAINT (x% + 9, y%), 7 LINE (x% - 10, y% - 5)-(x% + 10, y% + 5), 7, BF 'LINE (x% - 10, y% - 5)-(x% + 10, y% + 5), 7, BF END IF END IF IF er% = 1 THEN IF tpe% = 1 THEN LINE (x% - 20, y% - 15)-(x% + 20, y% + 15), 0, BF 'CIRCLE (x%, y% - 3), 10, 0 'PAINT (x%, y% - 3), 0 'CIRCLE (x% - 9, y%), 7, 0 'PAINT (x% - 9, y%), 0 'CIRCLE (x% + 9, y%), 7, 0 'PAINT (x% + 9, y%), 0 'LINE (x% - 10, y% - 5)-(x% + 10, y% + 5), 0, BF 'LINE (x% - 10, y% - 5)-(x% + 10, y% + 5), 0, BF END IF END IF END SUB SUB intro xi% = 10 yi% = 270 SCREEN 9 CLS FOR m% = 1 TO 100 RANDOMIZE TIMER i% = INT(RND * 640) + 1 RANDOMIZE TIMER j% = INT(RND * 250) + 1 PSET (i%, j%), 15 NEXT m% CIRCLE (500, 150), 130, 1 PAINT (500, 150), 1 FOR k% = 1 TO 30 RANDOMIZE TIMER j% = INT(RND * 180) - 50 RANDOMIZE TIMER m% = INT(RND * 180) - 50 FOR i% = 25 TO 1 STEP -2 CIRCLE (460 + j%, 110 + m%), i%, 2 NEXT i% NEXT k% FOR i% = 180 TO 130 STEP -1 CIRCLE (500, 150), i%, 0 NEXT i% FOR i% = 180 TO 130 STEP -1 CIRCLE (499, 150), i%, 0 NEXT i% LOCATE 1, 1 PRINT "The Earth." PRINT "A relatively civilized planet." PRINT "The creatures that live there are about to discover that there" PRINT "is another lifeform more intelligent and sophisticated" PRINT "than themselves." PRINT PRINT "And they haven't come here to play ping-pong..." SLEEP 7 FOR xi% = 1 TO 650 STEP 10 IF INKEY$ <> "" THEN EXIT SUB CIRCLE (xi% + 25, yi% + 5), 20, 13 PAINT (xi% + 25, yi%), 13 LINE (xi%, yi%)-(xi% + 50, yi% + 20), 7, BF CIRCLE (xi%, yi% + 10), 14, 7 PAINT (xi% - 1, yi% + 10), 7 CIRCLE (xi% + 50, yi% + 10), 14, 7 PAINT (xi% + 51, yi% + 10), 7 FOR m% = 1 TO 32000 NEXT m% LINE (0, 260)-(640, 350), 0, BF 'LINE (xi% - 20, yi% - 20)-(xi% + 20, yi% + 20), 0, BF NEXT xi% COLOR 11 CALL dissolve COLOR 14 CALL numbers COLOR 4, 0 LOCATE 10, 27 IF INKEY$ <> "" THEN EXIT SUB CALL teletype("HARDCORE SOFTWARE PRESENTS...", 5) SLEEP 1 CALL dissolve CALL numbers COLOR 3, 0 LOCATE 10, 22 IF INKEY$ <> "" THEN EXIT SUB CALL teletype("A HARDCORE SOFTWARE PRESENTATION...", 5) SLEEP 1 CALL dissolve SLEEP 1 COLOR 13 CALL numbers COLOR 11, 0 LOCATE 10, 35 IF INKEY$ <> "" THEN EXIT SUB CALL teletype("INVASION 3", 20) SLEEP 3 CALL dissolve CLS END SUB SUB mainmenu SCREEN 9 CALL structdef COLOR 15, 1 DO CLS LOCATE 1, 33 PRINT "INVASION #3" LOCATE 2, 30 PRINT "HARDCORE SOFTWARE" PRINT PRINT "1--Start a new game!" PRINT "2--Read the story!" IF level% > 1 THEN PRINT "3--Continue on level "; level% PRINT "x--Exit!" DO h$ = INKEY$ LOOP UNTIL h$ <> "" IF h$ = "1" THEN level% = 1 EXIT DO END IF IF h$ = "2" THEN CLS PRINT PRINT "You belong to the fearless and glorious race of the" PRINT "Harkoneese! You come from the planet Gelbatron." PRINT "Your name is Private Zaarkoonaput. Your mother ship has just" PRINT "arrived at a juicy, succulent planet, ripe for the picking!" PRINT "There's only one problem, it's inhabited by these disgusting pale" PRINT "creatures with no scales and only two arms!" PRINT PRINT "Your mission is to wipe out the human SAM missle sites" PRINT "in your modified ZK-11 saucer-fighter so that our" PRINT "ground troops can move in and wipe out the filthy race completely." PRINT "The more ground troops you kill, the better." PRINT "You get more points per troop as the levels progress." PRINT PRINT "The mission will require reflexes, skill, and bravery." PRINT PRINT "The controls are very straightforward." PRINT "Use the arrow keys to move Up/Left/Right/Down" PRINT "Space bar drops your bombs." PRINT PRINT "Everytime you die, you can continue on the previous level." PRINT PRINT "Good luck, Private Zaarkoonaput." PRINT INPUT "", junk$ END IF IF h$ = "3" THEN EXIT DO IF h$ = "x" THEN END IF h$ = "_" THEN INPUT "", cod$ IF LCASE$(cod$) = "guns of brixton" THEN codeson% = 1 END IF LOOP CLS CALL structdef END SUB SUB nextlevel IF level% > 0 THEN SCREEN 9 CLS IF level% = 10 THEN CALL win PRINT PRINT "CONGRATULATIONS!" PRINT IF codeson% = 1 THEN PRINT "YOU ARE USING CHEAT CODES! SHAME ON YOU! YOU LOSE ALL YOUR POINTS!" points! = 0 END IF PRINT PRINT "You've just passed level "; level% PRINT "Press enter to proceed to the next level, level "; level% + 1 PRINT INPUT "", junk$ CLS END IF level% = level% + 1 CALL structdef END SUB SUB numbers FOR j% = 1 TO 1500 RANDOMIZE TIMER i% = INT(RND * 79) + 1 RANDOMIZE TIMER m% = INT(RND * 25) + 1 RANDOMIZE TIMER u% = INT(RND * 50) + 1 LOCATE m%, i% PRINT CHR$(200 + u%) NEXT j% END SUB SUB structdef badshots% = oftenshoot% - (level% * 2) x% = 320 y% = 150 FOR i% = 1 TO 5 structs(i%, 1) = 0 NEXT i% IF level% > 4 THEN structs(1, 1) = 100 IF level% > 1 THEN structs(2, 1) = 200 IF level% > 0 THEN structs(3, 1) = 300 IF level% > 3 THEN structs(4, 1) = 400 IF level% > 2 THEN structs(5, 1) = 500 FOR i% = 1 TO 100 bullet(i%, 1) = -100 bullet(i%, 2) = -100 NEXT i% FOR i% = 1 TO 50 badbullet(i%, 1) = -100 badbullet(i%, 2) = -100 NEXT i% FOR i% = 1 TO 10 troops(i%, 1) = -100 NEXT i% END SUB SUB teletype (text$, Delay) '******************************************************************************* '* Prints text one character at a time beginning at the current cursor * '* location. Delay between each character being printed is measured in * '* 1/100ths second (delay of 100 = 1 second). If a value of zero or less * '* is specified, the delay defaults to 5/100ths of a second. If a key is * '* pressed during the SUB, remainder of string is printed with no delay * '******************************************************************************* d! = Delay ' if no delay, assign default IF d! < 1 THEN d! = 5 END IF ' change delay to 100ths second d! = d! / 100 ' print text 1 char at a time, with a "click" after non-space characters FOR x% = 1 TO LEN(text$) t$ = MID$(text$, x%, 1) PRINT t$; IF t$ <> " " THEN SOUND 20000, 1 END IF ' get current value of TIMER CurrentTimer! = TIMER ' delay appropriate time WHILE TIMER < (CurrentTimer! + d!) WEND ' stop delaying if a key is pressed IF INKEY$ <> "" THEN d! = 0 END IF NEXT x% END SUB SUB troopsupdate FOR i% = 1 TO 10 IF troops(i%, 1) <> -100 THEN CIRCLE (troops(i%, 1), 294), 1, 0 PSET (troops(i%, 1), 294), 0 LINE (troops(i%, 1) - 1, 296)-(troops(i%, 1) + 1, 299), 0, BF IF troops(i%, 2) = 1 THEN troops(i%, 1) = troops(i%, 1) + 2 IF troops(i%, 2) = 2 THEN troops(i%, 1) = troops(i%, 1) - 2 IF troops(i%, 1) < 75 THEN troops(i%, 1) = -100 IF troops(i%, 1) > 550 THEN troops(i%, 1) = -100 CIRCLE (troops(i%, 1), 294), 1, 14 PSET (troops(i%, 1), 294), 14 LINE (troops(i%, 1) - 1, 296)-(troops(i%, 1) + 1, 299), 11, BF END IF NEXT i% FOR i% = 1 TO 10 IF troops(i%, 1) = -100 THEN RANDOMIZE TIMER g% = INT(RND * troopsoften%) + 1 IF g% = 1 THEN RANDOMIZE TIMER u% = INT(RND * 2) + 1 IF u% = 1 THEN troops(i%, 1) = 80 troops(i%, 2) = 1 END IF IF u% = 2 THEN troops(i%, 1) = 545 troops(i%, 2) = 2 END IF END IF END IF NEXT i% END SUB SUB win SCREEN 9 CLS PRINT PRINT "YOU'VE WON!" PRINT IF codeson% = 1 THEN PRINT "YOU USED CHEAT CODES! SHAME ON YOU!" PRINT PRINT "You've destroyed the humans pathetic air defense systems!" PRINT "Soon our troops will land and take over the entire planet!" PRINT INPUT "", junk$ END END SUB SUB xyupdate x% = x% + speed(1) y% = y% + speed(2) IF mmloop% >= airvisc% THEN mmloop% = 0 IF speed(1) < 0 THEN speed(1) = speed(1) + 1 IF speed(1) > 0 THEN speed(1) = speed(1) - 1 IF speed(2) < 0 THEN speed(2) = speed(2) + 1 IF speed(2) > 0 THEN speed(2) = speed(2) - 1 END IF FOR i% = 1 TO 5 IF structs(i%, 1) = 0 THEN airclear% = airclear% + 1 NEXT i% IF airclear% = 5 THEN CALL nextlevel IF x% < 0 THEN x% = 630 IF x% > 640 THEN x% = 10 IF y% < 0 THEN y% = 0 IF y% > 300 THEN CALL death END SUB