Author Topic: Tech Invaders 2  (Read 5919 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Tech Invaders 2
« on: July 26, 2019, 07:18:01 pm »
After working on it more for around 7 hours non-stop, I made probably my best game I ever made. Here are the improvements from Tech Invaders 1:
1. 3 Enemy Robots at one time per level (except the Boss Level).
2. The Boss Level has a status bar so you know how much you have to hit him to destroy him.
3. All brand new robot graphics and boss.
4. Brand new Shooter.
5. Filled-in bullets from both your shooter and theirs.
6. And a better welcome screen (still text but you will see).
Tell me what you think, was really tough getting past some problems. There is still a slight problem with the Boss status bar, it comes back for a split second for some reason before it goes away completely when the boss is dead. No idea why lol. Anyways, I think it's more of a fun game than ever now. 860 lines of code, it better be. LOL!

(Note: Boss's status bar fixed and 1 other minor problem also fixed in the next post of my code, on the same page as this forum.)

Code: QB64: [Select]
  1. 'This version has 5 different colored robots with a Boss Robot after that.
  2. 'Each robot flies a different pattern.
  3. 'Game made on July 22, 2019
  4. 'By Ken G.
  5. 'Freeware
  6. 'I have put some descriptions in the code below to make it easier to learn from.
  7. begin:
  8. DIM name$(50), nm$(50), score(50), sccc(50)
  9. _TITLE "Tech Invaders 2"
  10. SCREEN _NEWIMAGE(800, 600, 32)
  11. FOR tt = 79 TO 34 STEP -1
  12.     LOCATE 3, tt + 1: PRINT " "
  13.     LOCATE 3, tt: PRINT "T"
  14.     _DELAY .03
  15. NEXT tt
  16. FOR ee = 79 TO 36 STEP -1
  17.     LOCATE 3, ee + 1: PRINT " "
  18.     LOCATE 3, ee: PRINT "E"
  19.     _DELAY .03
  20. NEXT ee
  21. FOR cc = 79 TO 38 STEP -1
  22.     LOCATE 3, cc + 1: PRINT " "
  23.     LOCATE 3, cc: PRINT "C"
  24.     _DELAY .03
  25. NEXT cc
  26. FOR hh = 79 TO 40 STEP -1
  27.     LOCATE 3, hh + 1: PRINT " "
  28.     LOCATE 3, hh: PRINT "H"
  29.     _DELAY .03
  30. NEXT hh
  31. FOR II = 79 TO 47 STEP -1
  32.     LOCATE 3, II + 1: PRINT " "
  33.     LOCATE 3, II: PRINT "I"
  34.     _DELAY .03
  35. NEXT II
  36. FOR NN = 79 TO 49 STEP -1
  37.     LOCATE 3, NN + 1: PRINT " "
  38.     LOCATE 3, NN: PRINT "N"
  39.     _DELAY .03
  40. NEXT NN
  41. FOR VV = 79 TO 51 STEP -1
  42.     LOCATE 3, VV + 1: PRINT " "
  43.     LOCATE 3, VV: PRINT "V"
  44.     _DELAY .03
  45. NEXT VV
  46. FOR AA = 79 TO 53 STEP -1
  47.     LOCATE 3, AA + 1: PRINT " "
  48.     LOCATE 3, AA: PRINT "A"
  49.     _DELAY .03
  50. NEXT AA
  51. FOR DD = 79 TO 55 STEP -1
  52.     LOCATE 3, DD + 1: PRINT " "
  53.     LOCATE 3, DD: PRINT "D"
  54.     _DELAY .03
  55. NEXT DD
  56. FOR EE2 = 79 TO 57 STEP -1
  57.     LOCATE 3, EE2 + 1: PRINT " "
  58.     LOCATE 3, EE2: PRINT "A"
  59.     _DELAY .03
  60. NEXT EE2
  61. FOR RR = 79 TO 59 STEP -1
  62.     LOCATE 3, RR + 1: PRINT " "
  63.     LOCATE 3, RR: PRINT "R"
  64.     _DELAY .03
  65. NEXT RR
  66. FOR ss = 79 TO 61 STEP -1
  67.     LOCATE 3, ss + 1: PRINT " "
  68.     LOCATE 3, ss: PRINT "S"
  69. NEXT ss
  70. 'PRINT "                                 T E C H      I N V A D E R S"
  71. PRINT "                                         T W O"
  72. PRINT "                                        by Ken G."
  73. PRINT "                       Use left and right arrow keys to move back and forth."
  74. PRINT "                            Use up or down arrow keys to stop moving."
  75. PRINT "                                    Use space bar to fire."
  76. PRINT "                                      Esc to end anytime."
  77. INPUT "                                   Press Enter to start.", start$
  78. e1 = 0
  79. E2 = 0
  80. e3 = 0
  81. lives = 5
  82. points = 0
  83. ushoot = 0
  84. shooting = 0
  85. level = 1
  86. level2 = 1
  87. start = 0
  88. s = 0
  89. xt = 400
  90. yt = 560
  91. B = 0
  92. boss = 0
  93.  
  94. 'Draw your shooter.
  95. FOR sz = .25 TO 10 STEP .25
  96.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  97. NEXT sz
  98. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  99.  
  100. OPENINGSOUND
  101.  
  102. 'This is the start of the main loop.
  103. go:
  104. 'Choose a random place for the enemy.
  105.  
  106. IF e1 = 0 AND E2 = 0 AND e3 = 0 THEN
  107.     xx = INT(RND * 200) + 100
  108.     yy = INT(RND * 100) + 40
  109.     xx2 = INT(RND * 200) + 200
  110.     yy2 = INT(RND * 100) + 40
  111.     xx3 = INT(RND * 200) + 250
  112.     yy3 = INT(RND * 100) + 40
  113.  
  114. 'Each level has its own loop so it can set a different equation and speed of the enemy.
  115.  
  116. IF level = 1 THEN
  117.     c1 = 128: c2 = 127: c3 = 255
  118.     one:
  119.     'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed.
  120.     sec = sec + .02
  121.     s = (60 - sec) * 6 + 180
  122.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  123.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  124.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  125.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  126.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  127.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  128.  
  129.     'GOSUB to drawing draws the enemy robot.
  130.     IF e1 <> 1 THEN GOSUB drawing:
  131.     IF E2 <> 1 THEN GOSUB drawing3:
  132.     IF e3 <> 1 THEN GOSUB drawing4:
  133.     _DELAY .006
  134.     GOSUB erase:
  135.     IF sec > 180 THEN
  136.         sec = 0
  137.         GOTO onedone:
  138.     END IF
  139.  
  140.     'GOSUB's go to keyboard control and enemy shooting.
  141.     GOSUB keyboard:
  142.     GOSUB shoot:
  143.     GOSUB youshoot2:
  144.     GOTO one:
  145.     onedone:
  146.  
  147. 'This level uses the spiral equation so it's a bit different than the others.
  148. IF level = 2 THEN
  149.     c1 = 127: c2 = 216: c3 = 127
  150.     xx = 400: yy = 300
  151.     xx2 = 100: yy2 = 300
  152.     xx3 = 600: yy3 = 300
  153.     FOR D = 160 TO 0 STEP -.125
  154.         _LIMIT 1000
  155.         s = s + .2
  156.         x = COS(s * 3.141592 / 180) * D
  157.         y = SIN(s * 3.151492 / 180) * D
  158.         x3 = COS(s * 3.141592 / 180) * D
  159.         y3 = SIN(s * 3.151492 / 180) * D
  160.         x4 = COS(s * 3.141592 / 180) * D
  161.         y4 = SIN(s * 3.151492 / 180) * D
  162.         IF e1 <> 1 THEN GOSUB drawing:
  163.         IF E2 <> 1 THEN GOSUB drawing3:
  164.         IF e3 <> 1 THEN GOSUB drawing4:
  165.         _DELAY .006
  166.         GOSUB erase:
  167.         GOSUB keyboard:
  168.         GOSUB shoot:
  169.         GOSUB youshoot2:
  170.     NEXT D
  171.     FOR D = 0 TO 160 STEP .125
  172.         _LIMIT 1000
  173.         s = s - .2
  174.         x = COS(s * 3.141592 / 180) * D
  175.         y = SIN(s * 3.151492 / 180) * D
  176.         x3 = COS(s * 3.141592 / 180) * D
  177.         y3 = SIN(s * 3.151492 / 180) * D
  178.         x4 = COS(s * 3.141592 / 180) * D
  179.         y4 = SIN(s * 3.151492 / 180) * D
  180.         IF e1 <> 1 THEN GOSUB drawing:
  181.         IF E2 <> 1 THEN GOSUB drawing3:
  182.         IF e3 <> 1 THEN GOSUB drawing4:
  183.         _DELAY .006
  184.         GOSUB erase:
  185.         GOSUB keyboard:
  186.         GOSUB shoot:
  187.         GOSUB youshoot2:
  188.     NEXT D
  189.  
  190. IF level = 3 THEN
  191.     c1 = 255: c2 = 0: c3 = 0
  192.     three:
  193.     sec = sec + .02
  194.     s = (60 - sec) * 6 + 180
  195.     x = INT(SIN(s / 90 * 3.141592) * 180) + 325
  196.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  197.     x3 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  198.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  199.     x4 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  200.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  201.     IF e1 <> 1 THEN GOSUB drawing:
  202.     IF E2 <> 1 THEN GOSUB drawing3:
  203.     IF e3 <> 1 THEN GOSUB drawing4:
  204.     _DELAY .006
  205.     GOSUB erase:
  206.     IF sec > 60 THEN
  207.         sec = 0
  208.         GOTO threedone:
  209.     END IF
  210.     GOSUB keyboard:
  211.     GOSUB shoot:
  212.     GOSUB youshoot2:
  213.     GOTO three:
  214.     threedone:
  215.  
  216. IF level = 4 THEN
  217.     c1 = 255: c2 = 255: c3 = 127
  218.     four:
  219.     sec = sec + .02
  220.     s = (60 - sec) * 6 + 180
  221.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  222.     y = INT(COS(s / 90 * 3.141592) * 180) + 225
  223.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  224.     y3 = INT(COS(s / 90 * 3.141592) * 180) + 225
  225.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  226.     y4 = INT(COS(s / 90 * 3.141592) * 180) + 225
  227.     IF e1 <> 1 THEN GOSUB drawing:
  228.     IF E2 <> 1 THEN GOSUB drawing3:
  229.     IF e3 <> 1 THEN GOSUB drawing4:
  230.     _DELAY .006
  231.     GOSUB erase:
  232.     IF sec > 60 THEN
  233.         sec = 0
  234.         GOTO fourdone:
  235.     END IF
  236.     GOSUB keyboard:
  237.     GOSUB shoot:
  238.     GOSUB youshoot2:
  239.     GOTO four:
  240.     fourdone:
  241. IF level = 5 THEN
  242.     c1 = 133: c2 = 28: c3 = 255
  243.     five:
  244.     sec = sec + .02
  245.     s = (60 - sec) * 6 + 180
  246.     x = INT(SIN(s / 135 * 3.141592) * 180) + 325
  247.     y = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  248.     x3 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  249.     y3 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  250.     x4 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  251.     y4 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  252.     IF e1 <> 1 THEN GOSUB drawing:
  253.     IF E2 <> 1 THEN GOSUB drawing3:
  254.     IF e3 <> 1 THEN GOSUB drawing4:
  255.     _DELAY .006
  256.     GOSUB erase:
  257.     IF sec > 60 THEN
  258.         sec = 0
  259.         GOTO fivedone:
  260.     END IF
  261.     GOSUB keyboard:
  262.     GOSUB shoot:
  263.     GOSUB youshoot2:
  264.     GOTO five:
  265.     fivedone:
  266.  
  267. IF level = 6 THEN
  268.     e1 = 0: E2 = 1: e3 = 1
  269.     boss = 1
  270.     c1 = 255: c2 = 0: c3 = 0
  271.     six:
  272.     sec = sec + .02
  273.     s = (60 - sec) * 6 + 180
  274.     x = INT(SIN(s / 45 * 3.141592) * 180) + 325
  275.     y = INT(COS(s / 360 * 3.141592) * 180) + 225
  276.     GOSUB drawing2:
  277.     IF sec > 120 THEN
  278.         sec = 0
  279.         GOTO sixdone:
  280.     END IF
  281.     GOSUB keyboard:
  282.     GOSUB shoot:
  283.     GOSUB youshoot2:
  284.     GOTO six:
  285.     sixdone:
  286.  
  287. IF level = 7 THEN level = 1
  288.  
  289. GOTO go:
  290. 'GOTO goes back to the start of the main loop.
  291.  
  292. 'Draws the enemy tank and erases it for animation.
  293. drawing:
  294. x2 = x + xx: y2 = y + yy
  295.  
  296. FOR t = 15 TO 20 STEP .25
  297.     CIRCLE (x2, y2), t, _RGB32(0, 255, 255)
  298. FOR t = .25 TO 15 STEP .25
  299.     CIRCLE (x2, y2), t, _RGB32(c1, c2, c3)
  300. FOR t = .25 TO 3 STEP .25
  301.     CIRCLE (x2 - 10, y2 - 5), t, _RGB32(0, 255, 255)
  302.     CIRCLE (x2 + 10, y2 - 5), t, _RGB32(0, 255, 255)
  303.     CIRCLE (x2, y2 + 10), t, _RGB32(0, 255, 255)
  304.  
  305.  
  306. drawing3:
  307. x5 = x3 + xx2: y5 = y3 + yy2
  308.  
  309. FOR t = 15 TO 20 STEP .25
  310.     CIRCLE (x5, y5), t, _RGB32(0, 255, 255)
  311. FOR t = .25 TO 15 STEP .25
  312.     CIRCLE (x5, y5), t, _RGB32(c1, c2, c3)
  313. FOR t = .25 TO 3 STEP .25
  314.     CIRCLE (x5 - 10, y5 - 5), t, _RGB32(0, 255, 255)
  315.     CIRCLE (x5 + 10, y5 - 5), t, _RGB32(0, 255, 255)
  316.     CIRCLE (x5, y5 + 10), t, _RGB32(0, 255, 255)
  317.  
  318. drawing4:
  319. x6 = x4 + xx3: y6 = y4 + yy3
  320.  
  321. FOR t = 15 TO 20 STEP .25
  322.     CIRCLE (x6, y6), t, _RGB32(0, 255, 255)
  323. FOR t = .25 TO 15 STEP .25
  324.     CIRCLE (x6, y6), t, _RGB32(c1, c2, c3)
  325. FOR t = .25 TO 3 STEP .25
  326.     CIRCLE (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255)
  327.     CIRCLE (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255)
  328.     CIRCLE (x6, y6 + 10), t, _RGB32(0, 255, 255)
  329.  
  330. IF e1 = 0 THEN
  331.     FOR t = .25 TO 20 STEP .25
  332.         CIRCLE (x2, y2), t, _RGB32(0, 0, 0)
  333.     NEXT t
  334. IF E2 = 0 THEN
  335.     FOR t = .25 TO 20 STEP .25
  336.         CIRCLE (x5, y5), t, _RGB32(0, 0, 0)
  337.     NEXT t
  338. IF e3 = 0 THEN
  339.     FOR t = .25 TO 20 STEP .25
  340.         CIRCLE (x6, y6), t, _RGB32(0, 0, 0)
  341.     NEXT t
  342.  
  343. 'Draws the Boss Robot.
  344. drawing2:
  345. x2 = x + xx: y2 = y + yy
  346. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 255, 0), BF
  347. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 255, 0), BF
  348. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 255, 0), BF
  349. FOR sz = .25 TO 3 STEP .25
  350.     CIRCLE (x2 - 5, y2 - 5), sz, _RGB32(0, 0, 0)
  351.     CIRCLE (x2 + 5, y2 - 5), sz, _RGB32(0, 0, 0)
  352. NEXT sz
  353. LINE (x2 - 5, y2 + 4)-(x2 + 5, y2 + 8), _RGB32(0, 0, 0), BF
  354. _DELAY .004
  355. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 0, 0), BF
  356. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 0, 0), BF
  357. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 0, 0), BF
  358.  
  359. 'Keyboard control for your movement and shooting.
  360. keyboard:
  361. _LIMIT 1000
  362. a$ = INKEY$
  363. IF a$ = CHR$(27) THEN END
  364. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: l = 0
  365. IF r = 1 THEN
  366.     FOR sz = .25 TO 10 STEP .25
  367.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  368.     NEXT sz
  369.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  370.     xt = xt + 1
  371.     IF xt > 780 THEN xt = 780
  372.     FOR sz = .25 TO 10 STEP .25
  373.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  374.     NEXT sz
  375.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  376. IF a$ = CHR$(0) + CHR$(75) THEN l = 1: r = 0
  377. IF l = 1 THEN
  378.     FOR sz = .25 TO 10 STEP .25
  379.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  380.     NEXT sz
  381.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  382.     xt = xt - 1
  383.     IF xt < 0 THEN xt = 0
  384.     FOR sz = .25 TO 10 STEP .25
  385.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  386.     NEXT sz
  387.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  388. IF a$ = CHR$(0) + CHR$(72) OR a$ = CHR$(0) + CHR$(80) THEN
  389.     r = 0: l = 0
  390.  
  391. IF a$ = " " THEN GOSUB youshoot:
  392.  
  393. 'The start of your shot.
  394. youshoot:
  395. _LIMIT 1000
  396.  
  397. 'sx2 and sy2 are your shot coordinates.
  398. IF ushoot = 0 THEN
  399.     sx2 = xt + 10
  400.     sy2 = yt - 20
  401.     ushoot = 1
  402.     SOUND 400, .5
  403.  
  404. 'The drawing and movement of your shot and if it reaches the enemy.
  405. youshoot2:
  406. _LIMIT 1000
  407. IF ushoot = 1 THEN
  408.     FOR sz = .25 TO 5 STEP .25
  409.         CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  410.     NEXT sz
  411.     sy2 = sy2 - 3
  412.     IF sy2 < 0 THEN ushoot = 0: RETURN
  413.     FOR szz = .25 TO 5 STEP .25
  414.         CIRCLE (sx2, sy2), szz, _RGB32(255, 0, 0)
  415.     NEXT szz
  416.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 0 THEN
  417.         ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  418.         FOR sz = .25 TO 5 STEP .25
  419.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  420.         NEXT sz
  421.         points = points + 100
  422.         e1 = 1
  423.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  424.             level = level + 1
  425.             level2 = level2 + 1
  426.             e1 = 0: E2 = 0: e3 = 0
  427.         END IF
  428.         lives$ = STR$(lives)
  429.         points$ = STR$(points)
  430.         level$ = STR$(level2)
  431.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  432.         ushoot = 0
  433.         GOTO go:
  434.     END IF
  435.     IF sx2 > x5 - 21 AND sx2 < x5 + 41 AND sy2 > y5 - 11 AND sy2 < y5 + 21 AND E2 = 0 AND boss = 0 THEN
  436.         ENEMYEXPLOSION2 sx2, sy2, x5, y5, sx3, sy3
  437.         FOR sz = .25 TO 5 STEP .25
  438.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  439.         NEXT sz
  440.         points = points + 100
  441.         E2 = 1
  442.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  443.             level = level + 1
  444.             level2 = level2 + 1
  445.             e1 = 0: E2 = 0: e3 = 0
  446.         END IF
  447.         lives$ = STR$(lives)
  448.         points$ = STR$(points)
  449.         level$ = STR$(level2)
  450.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  451.         ushoot = 0
  452.         GOTO go:
  453.     END IF
  454.     IF sx2 > x6 - 21 AND sx2 < x6 + 41 AND sy2 > y6 - 11 AND sy2 < y6 + 21 AND e3 = 0 AND boss = 0 THEN
  455.         ENEMYEXPLOSION3 sx2, sy2, x6, y6, sx4, sy4
  456.         FOR sz = .25 TO 5 STEP .25
  457.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  458.         NEXT sz
  459.         points = points + 100
  460.         e3 = 1
  461.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  462.             level = level + 1
  463.             level2 = level2 + 1
  464.             e1 = 0: E2 = 0: e3 = 0
  465.         END IF
  466.         lives$ = STR$(lives)
  467.         points$ = STR$(points)
  468.         level$ = STR$(level2)
  469.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  470.         ushoot = 0
  471.         GOTO go:
  472.     END IF
  473.  
  474.     'To see if you hit the Boss.
  475.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 1 THEN
  476.         B = B + 1
  477.         BB = 10 - B
  478.         LOCATE 3, 3: PRINT "BOSS ROBOT:"
  479.         IF bx = 0 THEN GOTO bxx:
  480.         LINE (150, 30)-(bx + 150, 50), _RGB32(0, 0, 0), BF
  481.         bxx:
  482.         bx = BB * 10
  483.         LINE (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF
  484.         SOUND 100, 1
  485.         points = points + 100
  486.         lives$ = STR$(lives)
  487.         points$ = STR$(points)
  488.         level$ = STR$(level2)
  489.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  490.         FOR sz = .25 TO 5 STEP .25
  491.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  492.         NEXT sz
  493.         IF B > 10 THEN ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  494.         IF B < 11 THEN ushoot = 0: RETURN
  495.         LINE (0, 0)-(800, 200), _RGB32(0, 0, 0), BF
  496.         bx = 0
  497.         BB = 0
  498.         B = 0
  499.         boss = 0
  500.         points = points + 1000
  501.         level = level + 1
  502.         level2 = level2 + 1
  503.         e1 = 0: E2 = 0: e3 = 0
  504.         lives$ = STR$(lives)
  505.         points$ = STR$(points)
  506.         level$ = STR$(level2)
  507.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  508.         ushoot = 0
  509.         GOTO go:
  510.     END IF
  511.  
  512. 'The enemy's shot and if it reaches you.
  513. shoot:
  514. _LIMIT 1000
  515. IF shooting = 0 AND e1 = 0 THEN
  516.     GOSUB checktoshoot:
  517.     sh = INT(RND * 10000) + 1
  518.     IF sh < shh THEN GOTO nexone:
  519.  
  520.     'sx and sy are the first enemy shot coordinates.
  521.     sx = x2 + 10
  522.     sy = y2 + 10
  523.     shooting = 1
  524.     SOUND 300, .5
  525. nexone:
  526. IF shooting2 = 0 AND E2 = 0 THEN
  527.     GOSUB checktoshoot:
  528.     sh2 = INT(RND * 10000) + 1
  529.     IF sh2 < shh THEN GOTO nexone2:
  530.  
  531.     'sx3 and sy3 are the second enemy shot coordinates.
  532.     sx3 = x5 + 10
  533.     sy3 = y5 + 10
  534.     shooting2 = 1
  535.     SOUND 300, .5
  536. nexone2:
  537. IF shooting3 = 0 AND e3 = 0 THEN
  538.     GOSUB checktoshoot:
  539.     sh3 = INT(RND * 10000) + 1
  540.     IF sh3 < shh THEN GOTO nexone3:
  541.  
  542.     'sx4 and sy4 are the third enemy shot coordinates.
  543.     sx4 = x6 + 10
  544.     sy4 = y6 + 10
  545.     shooting3 = 1
  546.     SOUND 300, .5
  547.  
  548. nexone3:
  549. 'To see if first enemy hit you.
  550. IF shooting = 1 AND e1 = 0 THEN
  551.     FOR sz2 = .25 TO 5 STEP .25
  552.         CIRCLE (sx, sy), sz2, _RGB32(0, 0, 0)
  553.     NEXT sz2
  554.     sy = sy + 3
  555.     IF sy > 620 THEN shooting = 0: GOTO nex4:
  556.     FOR szz2 = .25 TO 5 STEP .25
  557.         CIRCLE (sx, sy), szz2, _RGB32(255, 0, 0)
  558.     NEXT szz2
  559.     IF sx > xt - 1 AND sx < xt + 21 AND sy > yt - 1 AND sy < yt + 21 THEN
  560.         FOR sz3 = .25 TO 5 STEP .25
  561.             CIRCLE (sx, sy), sz3, _RGB32(0, 0, 0)
  562.         NEXT sz3
  563.         shooting = 0
  564.         GOSUB explosion:
  565.     END IF
  566. nex4:
  567.  
  568. 'To see if second enemy hit you.
  569. IF shooting2 = 1 AND E2 = 0 THEN
  570.     FOR sz2 = .25 TO 5 STEP .25
  571.         CIRCLE (sx3, sy3), sz2, _RGB32(0, 0, 0)
  572.     NEXT sz2
  573.     sy3 = sy3 + 3
  574.     IF sy3 > 620 THEN shooting2 = 0: GOTO nexx:
  575.     FOR szz2 = .25 TO 5 STEP .25
  576.         CIRCLE (sx3, sy3), szz2, _RGB32(255, 0, 0)
  577.     NEXT szz2
  578.     IF sx3 > xt - 1 AND sx3 < xt + 21 AND sy3 > yt - 1 AND sy3 < yt + 21 THEN
  579.         FOR sz3 = .25 TO 5 STEP .25
  580.             CIRCLE (sx3, sy3), sz3, _RGB32(0, 0, 0)
  581.         NEXT sz3
  582.         shooting2 = 0
  583.         GOSUB explosion:
  584.     END IF
  585.  
  586. nexx:
  587. 'To see if third enemy hit you.
  588. IF shooting3 = 1 AND e3 = 0 THEN
  589.     FOR sz2 = .25 TO 5 STEP .25
  590.         CIRCLE (sx4, sy4), sz2, _RGB32(0, 0, 0)
  591.     NEXT sz2
  592.     sy4 = sy4 + 3
  593.     IF sy4 > 620 THEN shooting3 = 0: RETURN
  594.     FOR szz2 = .25 TO 5 STEP .25
  595.         CIRCLE (sx4, sy4), szz2, _RGB32(255, 0, 0)
  596.     NEXT szz2
  597.     IF sx4 > xt - 1 AND sx4 < xt + 21 AND sy4 > yt - 1 AND sy4 < yt + 21 THEN
  598.         FOR sz3 = .25 TO 5 STEP .25
  599.             CIRCLE (sx4, sy4), sz3, _RGB32(0, 0, 0)
  600.         NEXT sz3
  601.         shooting3 = 0
  602.         GOSUB explosion:
  603.     END IF
  604.  
  605.  
  606. explosion:
  607. SOUND 200, 1
  608. SOUND 100, 1
  609. FOR explosion2 = 1 TO 30
  610.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(255, 0, 0)
  611.     _DELAY .02
  612.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(0, 0, 0)
  613. NEXT explosion2
  614. lives = lives - 1
  615. lives$ = STR$(lives)
  616. points$ = STR$(points)
  617. level$ = STR$(level2)
  618. _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  619. LINE (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF
  620. IF lives = 0 THEN
  621.     LOCATE 20, 40: PRINT "G A M E   O V E R"
  622.     LOCATE 22, 40: PRINT "Score: "; points
  623.     LOCATE 23, 40: PRINT "Level: "; level2
  624.     LOCATE 25, 40: INPUT "Press Enter to go to Top Ten Scores.", tt$
  625.  
  626.     'Top Ten Scores
  627.     scc = points
  628.     IF _FILEEXISTS("toptentech.txt") THEN
  629.     ELSE
  630.         OPEN "toptentech.txt" FOR OUTPUT AS #1
  631.         RESTORE originaltopten
  632.         DO
  633.             READ toptenname$, toptenscore!
  634.             IF toptenname$ = "EOF" THEN EXIT DO
  635.             PRINT #1, toptenname$
  636.             PRINT #1, toptenscore!
  637.         LOOP
  638.         CLOSE #1
  639.     END IF
  640.  
  641.     OPEN "toptentech.txt" FOR INPUT AS #1
  642.     FOR n = 1 TO 10
  643.         INPUT #1, name$(n)
  644.         INPUT #1, score(n)
  645.         IF scc > score(n) AND sct = 0 THEN
  646.             NN = n
  647.             PRINT "You have made the Top Ten!"
  648.             typename:
  649.             INPUT "Type your name here (25 letters and spaces maximum.):", nm$(NN)
  650.             IF LEN(nm$(NN)) > 25 THEN
  651.                 PRINT "Name too long, try again."
  652.                 GOTO typename:
  653.             END IF
  654.             sccc(NN) = scc
  655.             sct = 1
  656.         END IF
  657.         IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  658.     NEXT n
  659.     CLOSE #1
  660.     nex5:
  661.     CLOSE #1
  662.     OPEN "toptentech.txt" FOR OUTPUT AS #1
  663.     FOR n = 1 TO NN
  664.         IF n <> NN THEN PRINT #1, name$(n): PRINT #1, score(n)
  665.         IF n = NN THEN
  666.             PRINT #1, nm$(n)
  667.             PRINT #1, sccc(n)
  668.         END IF
  669.     NEXT n
  670.     nex6:
  671.     FOR n = NN TO 10
  672.         PRINT #1, name$(n): PRINT #1, score(n)
  673.     NEXT n
  674.     CLOSE #1
  675.     nex7:
  676.     CLS
  677.     PRINT: PRINT: PRINT
  678.     PRINT "                                         T O P    T E N "
  679.     PRINT: PRINT: PRINT
  680.     OPEN "toptentech.txt" FOR INPUT AS #1
  681.     FOR n = 1 TO 10
  682.         IF EOF(1) THEN GOTO nex8:
  683.         INPUT #1, name$(n)
  684.         INPUT #1, score(n)
  685.         PRINT "             "; n; ". "; name$(n); score(n)
  686.     NEXT n
  687.     nex8:
  688.     CLOSE #1
  689.     FOR n = 1 TO 10
  690.         nm$(n) = ""
  691.         score(n) = 0
  692.         name$(n) = ""
  693.         sccc(n) = 0
  694.     NEXT n
  695.     NN = 0
  696.     n = 0
  697.     sct = 0
  698.     scc = 0
  699.     LOCATE 23, 1
  700.     INPUT "Would you like to play again? (Yes/No)", ag$
  701.     IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" OR ag$ = "YEs" THEN GOTO begin:
  702.     END
  703. OPENINGSOUND
  704.  
  705. checktoshoot:
  706. IF level2 = 1 THEN shh = 9950
  707. IF level2 = 2 THEN shh = 9945
  708. IF level2 = 3 THEN shh = 9940
  709. IF level2 = 4 THEN shh = 9935
  710. IF level2 = 5 THEN shh = 9930
  711. IF level2 = 6 THEN shh = 9925
  712. IF level2 > 6 THEN shh = 9920
  713.  
  714.  
  715.  
  716. originaltopten:
  717. DATA Space Ace,7000
  718. DATA Suzy Swift,6000
  719. DATA Speedy Spencer,5000
  720. DATA Super Sam,4000
  721. DATA Battery Bob,3000
  722. DATA Karen Kryptonite,2750
  723. DATA Quick Ken,2500
  724. DATA Tiger Tessa,2250
  725. DATA Arcade Joe,2000
  726. DATA How Do U Play,1750
  727.  
  728. SUB OPENINGSOUND
  729.     snd = 300
  730.     snd2 = 800
  731.     FOR t = 1 TO 50
  732.         IF snd > 800 THEN snd = 300
  733.         IF snd2 < 300 THEN snd2 = 800
  734.         snd = snd + 10
  735.         SOUND snd, .25
  736.     NEXT t
  737.  
  738. SUB ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy)
  739.     SOUND 200, 1
  740.     SOUND 100, 1
  741.     FOR sz4 = .25 TO 5 STEP .25
  742.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  743.     NEXT sz4
  744.     FOR explosion = 1 TO 30
  745.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(255, 0, 0)
  746.         _LIMIT 100
  747.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(0, 0, 0)
  748.     NEXT explosion
  749.     LINE (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF
  750.     FOR sz4 = .25 TO 5 STEP .25
  751.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  752.     NEXT sz4
  753.     FOR sz4 = .25 TO 5 STEP .25
  754.         CIRCLE (sx, sy), sz4, _RGB32(0, 0, 0)
  755.     NEXT sz4
  756.  
  757.  
  758. SUB ENEMYEXPLOSION2 (sx2, sy2, x5, y5, sx3, sy3)
  759.     SOUND 200, 1
  760.     SOUND 100, 1
  761.     FOR sz5 = .25 TO 5 STEP .25
  762.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  763.     NEXT sz5
  764.     FOR explosion = 1 TO 30
  765.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(255, 0, 0)
  766.         _LIMIT 100
  767.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(0, 0, 0)
  768.     NEXT explosion
  769.     LINE (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF
  770.     FOR sz5 = .25 TO 5 STEP .25
  771.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  772.     NEXT sz5
  773.     FOR sz5 = .25 TO 5 STEP .25
  774.         CIRCLE (sx3, sy3), sz5, _RGB32(0, 0, 0)
  775.     NEXT sz5
  776.  
  777.  
  778. SUB ENEMYEXPLOSION3 (sx2, sy2, x6, y6, sx4, sy4)
  779.     SOUND 200, 1
  780.     SOUND 100, 1
  781.     FOR sz6 = .25 TO 5 STEP .25
  782.         CIRCLE (sx2, sy2), sz6, _RGB32(0, 0, 0)
  783.     NEXT sz6
  784.     FOR explosion = 1 TO 30
  785.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(255, 0, 0)
  786.         _LIMIT 100
  787.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(0, 0, 0)
  788.     NEXT explosion
  789.     LINE (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF
  790.     FOR sz5 = .25 TO 5 STEP .25
  791.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  792.     NEXT sz5
  793.     FOR sz5 = .25 TO 5 STEP .25
  794.         CIRCLE (sx4, sy4), sz5, _RGB32(0, 0, 0)
  795.     NEXT sz5
  796.  
  797.  
« Last Edit: July 26, 2019, 08:42:57 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tech Invaders 2
« Reply #1 on: July 26, 2019, 08:19:45 pm »
Very nice game!

E instead of A?
Code: QB64: [Select]
  1. FOR EE2 = 79 TO 57 STEP -1
  2.     LOCATE 3, EE2 + 1: PRINT " "
  3.     LOCATE 3, EE2: PRINT "A"
  4.     _DELAY .03
  5. NEXT EE2
  6.  
« Last Edit: July 26, 2019, 08:28:02 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #2 on: July 26, 2019, 08:41:48 pm »
LOL! Thanks B+, I made that as the last thing, in a rush kinda. I also just fixed the Boss's status bar. I accidentally went under 0 on a variable right before it went to the next level, which made the bar go the other direction I think lol. I also added a _delay on the last letter on the welcome page to make it even with the others.
Here is the fixed version.

(Shooter disappearing act is fixed below on this forum page.)

Code: QB64: [Select]
  1. 'Tech Invaders 2
  2. 'Game made on July 26, 2019
  3. 'By Ken G.
  4. 'Freeware
  5. 'I have put some descriptions in the code below to make it easier to learn from.
  6. begin:
  7. DIM name$(50), nm$(50), score(50), sccc(50)
  8. _TITLE "Tech Invaders 2"
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. FOR tt = 79 TO 34 STEP -1
  11.     LOCATE 3, tt + 1: PRINT " "
  12.     LOCATE 3, tt: PRINT "T"
  13.     _DELAY .03
  14. NEXT tt
  15. FOR ee = 79 TO 36 STEP -1
  16.     LOCATE 3, ee + 1: PRINT " "
  17.     LOCATE 3, ee: PRINT "E"
  18.     _DELAY .03
  19. NEXT ee
  20. FOR cc = 79 TO 38 STEP -1
  21.     LOCATE 3, cc + 1: PRINT " "
  22.     LOCATE 3, cc: PRINT "C"
  23.     _DELAY .03
  24. NEXT cc
  25. FOR hh = 79 TO 40 STEP -1
  26.     LOCATE 3, hh + 1: PRINT " "
  27.     LOCATE 3, hh: PRINT "H"
  28.     _DELAY .03
  29. NEXT hh
  30. FOR II = 79 TO 47 STEP -1
  31.     LOCATE 3, II + 1: PRINT " "
  32.     LOCATE 3, II: PRINT "I"
  33.     _DELAY .03
  34. NEXT II
  35. FOR NN = 79 TO 49 STEP -1
  36.     LOCATE 3, NN + 1: PRINT " "
  37.     LOCATE 3, NN: PRINT "N"
  38.     _DELAY .03
  39. NEXT NN
  40. FOR VV = 79 TO 51 STEP -1
  41.     LOCATE 3, VV + 1: PRINT " "
  42.     LOCATE 3, VV: PRINT "V"
  43.     _DELAY .03
  44. NEXT VV
  45. FOR AA = 79 TO 53 STEP -1
  46.     LOCATE 3, AA + 1: PRINT " "
  47.     LOCATE 3, AA: PRINT "A"
  48.     _DELAY .03
  49. NEXT AA
  50. FOR DD = 79 TO 55 STEP -1
  51.     LOCATE 3, DD + 1: PRINT " "
  52.     LOCATE 3, DD: PRINT "D"
  53.     _DELAY .03
  54. NEXT DD
  55. FOR EE2 = 79 TO 57 STEP -1
  56.     LOCATE 3, EE2 + 1: PRINT " "
  57.     LOCATE 3, EE2: PRINT "E"
  58.     _DELAY .03
  59. NEXT EE2
  60. FOR RR = 79 TO 59 STEP -1
  61.     LOCATE 3, RR + 1: PRINT " "
  62.     LOCATE 3, RR: PRINT "R"
  63.     _DELAY .03
  64. NEXT RR
  65. FOR ss = 79 TO 61 STEP -1
  66.     LOCATE 3, ss + 1: PRINT " "
  67.     LOCATE 3, ss: PRINT "S"
  68.     _DELAY .03
  69. NEXT ss
  70. PRINT "                                         T W O"
  71. PRINT "                                        by Ken G."
  72. PRINT "                       Use left and right arrow keys to move back and forth."
  73. PRINT "                            Use up or down arrow keys to stop moving."
  74. PRINT "                                    Use space bar to fire."
  75. PRINT "                                      Esc to end anytime."
  76. INPUT "                                   Press Enter to start.", start$
  77. e1 = 0
  78. E2 = 0
  79. e3 = 0
  80. lives = 5
  81. points = 0
  82. ushoot = 0
  83. shooting = 0
  84. level = 1
  85. level2 = 1
  86. start = 0
  87. s = 0
  88. xt = 400
  89. yt = 560
  90. B = 0
  91. boss = 0
  92.  
  93. 'Draw your shooter.
  94. FOR sz = .25 TO 10 STEP .25
  95.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  96. NEXT sz
  97. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  98.  
  99. OPENINGSOUND
  100.  
  101. 'This is the start of the main loop.
  102. go:
  103. 'Choose a random place for the enemy.
  104.  
  105. IF e1 = 0 AND E2 = 0 AND e3 = 0 THEN
  106.     xx = INT(RND * 200) + 100
  107.     yy = INT(RND * 100) + 40
  108.     xx2 = INT(RND * 200) + 200
  109.     yy2 = INT(RND * 100) + 40
  110.     xx3 = INT(RND * 200) + 250
  111.     yy3 = INT(RND * 100) + 40
  112.  
  113. 'Each level has its own loop so it can set a different equation and speed of the enemy.
  114.  
  115. IF level = 1 THEN
  116.     c1 = 128: c2 = 127: c3 = 255
  117.     one:
  118.     'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed.
  119.     sec = sec + .02
  120.     s = (60 - sec) * 6 + 180
  121.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  122.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  123.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  124.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  125.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  126.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  127.  
  128.     'GOSUB to drawing draws the enemy robot.
  129.     IF e1 <> 1 THEN GOSUB drawing:
  130.     IF E2 <> 1 THEN GOSUB drawing3:
  131.     IF e3 <> 1 THEN GOSUB drawing4:
  132.     _DELAY .006
  133.     GOSUB erase:
  134.     IF sec > 180 THEN
  135.         sec = 0
  136.         GOTO onedone:
  137.     END IF
  138.  
  139.     'GOSUB's go to keyboard control and enemy shooting.
  140.     GOSUB keyboard:
  141.     GOSUB shoot:
  142.     GOSUB youshoot2:
  143.     GOTO one:
  144.     onedone:
  145.  
  146. 'This level uses the spiral equation so it's a bit different than the others.
  147. IF level = 2 THEN
  148.     c1 = 127: c2 = 216: c3 = 127
  149.     xx = 400: yy = 300
  150.     xx2 = 100: yy2 = 300
  151.     xx3 = 600: yy3 = 300
  152.     FOR D = 160 TO 0 STEP -.125
  153.         _LIMIT 1000
  154.         s = s + .2
  155.         x = COS(s * 3.141592 / 180) * D
  156.         y = SIN(s * 3.151492 / 180) * D
  157.         x3 = COS(s * 3.141592 / 180) * D
  158.         y3 = SIN(s * 3.151492 / 180) * D
  159.         x4 = COS(s * 3.141592 / 180) * D
  160.         y4 = SIN(s * 3.151492 / 180) * D
  161.         IF e1 <> 1 THEN GOSUB drawing:
  162.         IF E2 <> 1 THEN GOSUB drawing3:
  163.         IF e3 <> 1 THEN GOSUB drawing4:
  164.         _DELAY .006
  165.         GOSUB erase:
  166.         GOSUB keyboard:
  167.         GOSUB shoot:
  168.         GOSUB youshoot2:
  169.     NEXT D
  170.     FOR D = 0 TO 160 STEP .125
  171.         _LIMIT 1000
  172.         s = s - .2
  173.         x = COS(s * 3.141592 / 180) * D
  174.         y = SIN(s * 3.151492 / 180) * D
  175.         x3 = COS(s * 3.141592 / 180) * D
  176.         y3 = SIN(s * 3.151492 / 180) * D
  177.         x4 = COS(s * 3.141592 / 180) * D
  178.         y4 = SIN(s * 3.151492 / 180) * D
  179.         IF e1 <> 1 THEN GOSUB drawing:
  180.         IF E2 <> 1 THEN GOSUB drawing3:
  181.         IF e3 <> 1 THEN GOSUB drawing4:
  182.         _DELAY .006
  183.         GOSUB erase:
  184.         GOSUB keyboard:
  185.         GOSUB shoot:
  186.         GOSUB youshoot2:
  187.     NEXT D
  188.  
  189. IF level = 3 THEN
  190.     c1 = 255: c2 = 0: c3 = 0
  191.     three:
  192.     sec = sec + .02
  193.     s = (60 - sec) * 6 + 180
  194.     x = INT(SIN(s / 90 * 3.141592) * 180) + 325
  195.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  196.     x3 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  197.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  198.     x4 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  199.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  200.     IF e1 <> 1 THEN GOSUB drawing:
  201.     IF E2 <> 1 THEN GOSUB drawing3:
  202.     IF e3 <> 1 THEN GOSUB drawing4:
  203.     _DELAY .006
  204.     GOSUB erase:
  205.     IF sec > 60 THEN
  206.         sec = 0
  207.         GOTO threedone:
  208.     END IF
  209.     GOSUB keyboard:
  210.     GOSUB shoot:
  211.     GOSUB youshoot2:
  212.     GOTO three:
  213.     threedone:
  214.  
  215. IF level = 4 THEN
  216.     c1 = 255: c2 = 255: c3 = 127
  217.     four:
  218.     sec = sec + .02
  219.     s = (60 - sec) * 6 + 180
  220.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  221.     y = INT(COS(s / 90 * 3.141592) * 180) + 225
  222.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  223.     y3 = INT(COS(s / 90 * 3.141592) * 180) + 225
  224.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  225.     y4 = INT(COS(s / 90 * 3.141592) * 180) + 225
  226.     IF e1 <> 1 THEN GOSUB drawing:
  227.     IF E2 <> 1 THEN GOSUB drawing3:
  228.     IF e3 <> 1 THEN GOSUB drawing4:
  229.     _DELAY .006
  230.     GOSUB erase:
  231.     IF sec > 60 THEN
  232.         sec = 0
  233.         GOTO fourdone:
  234.     END IF
  235.     GOSUB keyboard:
  236.     GOSUB shoot:
  237.     GOSUB youshoot2:
  238.     GOTO four:
  239.     fourdone:
  240. IF level = 5 THEN
  241.     c1 = 133: c2 = 28: c3 = 255
  242.     five:
  243.     sec = sec + .02
  244.     s = (60 - sec) * 6 + 180
  245.     x = INT(SIN(s / 135 * 3.141592) * 180) + 325
  246.     y = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  247.     x3 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  248.     y3 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  249.     x4 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  250.     y4 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  251.     IF e1 <> 1 THEN GOSUB drawing:
  252.     IF E2 <> 1 THEN GOSUB drawing3:
  253.     IF e3 <> 1 THEN GOSUB drawing4:
  254.     _DELAY .006
  255.     GOSUB erase:
  256.     IF sec > 60 THEN
  257.         sec = 0
  258.         GOTO fivedone:
  259.     END IF
  260.     GOSUB keyboard:
  261.     GOSUB shoot:
  262.     GOSUB youshoot2:
  263.     GOTO five:
  264.     fivedone:
  265.  
  266. IF level = 6 THEN
  267.     e1 = 0: E2 = 1: e3 = 1
  268.     boss = 1
  269.     c1 = 255: c2 = 0: c3 = 0
  270.     six:
  271.     sec = sec + .02
  272.     s = (60 - sec) * 6 + 180
  273.     x = INT(SIN(s / 45 * 3.141592) * 180) + 325
  274.     y = INT(COS(s / 360 * 3.141592) * 180) + 225
  275.     GOSUB drawing2:
  276.     IF sec > 120 THEN
  277.         sec = 0
  278.         GOTO sixdone:
  279.     END IF
  280.     GOSUB keyboard:
  281.     GOSUB shoot:
  282.     GOSUB youshoot2:
  283.     GOTO six:
  284.     sixdone:
  285.  
  286. IF level = 7 THEN level = 1
  287.  
  288. GOTO go:
  289. 'GOTO goes back to the start of the main loop.
  290.  
  291. 'Draws the enemy tank and erases it for animation.
  292. drawing:
  293. x2 = x + xx: y2 = y + yy
  294.  
  295. FOR t = 15 TO 20 STEP .25
  296.     CIRCLE (x2, y2), t, _RGB32(0, 255, 255)
  297. FOR t = .25 TO 15 STEP .25
  298.     CIRCLE (x2, y2), t, _RGB32(c1, c2, c3)
  299. FOR t = .25 TO 3 STEP .25
  300.     CIRCLE (x2 - 10, y2 - 5), t, _RGB32(0, 255, 255)
  301.     CIRCLE (x2 + 10, y2 - 5), t, _RGB32(0, 255, 255)
  302.     CIRCLE (x2, y2 + 10), t, _RGB32(0, 255, 255)
  303.  
  304.  
  305. drawing3:
  306. x5 = x3 + xx2: y5 = y3 + yy2
  307.  
  308. FOR t = 15 TO 20 STEP .25
  309.     CIRCLE (x5, y5), t, _RGB32(0, 255, 255)
  310. FOR t = .25 TO 15 STEP .25
  311.     CIRCLE (x5, y5), t, _RGB32(c1, c2, c3)
  312. FOR t = .25 TO 3 STEP .25
  313.     CIRCLE (x5 - 10, y5 - 5), t, _RGB32(0, 255, 255)
  314.     CIRCLE (x5 + 10, y5 - 5), t, _RGB32(0, 255, 255)
  315.     CIRCLE (x5, y5 + 10), t, _RGB32(0, 255, 255)
  316.  
  317. drawing4:
  318. x6 = x4 + xx3: y6 = y4 + yy3
  319.  
  320. FOR t = 15 TO 20 STEP .25
  321.     CIRCLE (x6, y6), t, _RGB32(0, 255, 255)
  322. FOR t = .25 TO 15 STEP .25
  323.     CIRCLE (x6, y6), t, _RGB32(c1, c2, c3)
  324. FOR t = .25 TO 3 STEP .25
  325.     CIRCLE (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255)
  326.     CIRCLE (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255)
  327.     CIRCLE (x6, y6 + 10), t, _RGB32(0, 255, 255)
  328.  
  329. IF e1 = 0 THEN
  330.     FOR t = .25 TO 20 STEP .25
  331.         CIRCLE (x2, y2), t, _RGB32(0, 0, 0)
  332.     NEXT t
  333. IF E2 = 0 THEN
  334.     FOR t = .25 TO 20 STEP .25
  335.         CIRCLE (x5, y5), t, _RGB32(0, 0, 0)
  336.     NEXT t
  337. IF e3 = 0 THEN
  338.     FOR t = .25 TO 20 STEP .25
  339.         CIRCLE (x6, y6), t, _RGB32(0, 0, 0)
  340.     NEXT t
  341.  
  342. 'Draws the Boss Robot.
  343. drawing2:
  344. x2 = x + xx: y2 = y + yy
  345. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 255, 0), BF
  346. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 255, 0), BF
  347. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 255, 0), BF
  348. FOR sz = .25 TO 3 STEP .25
  349.     CIRCLE (x2 - 5, y2 - 5), sz, _RGB32(0, 0, 0)
  350.     CIRCLE (x2 + 5, y2 - 5), sz, _RGB32(0, 0, 0)
  351. NEXT sz
  352. LINE (x2 - 5, y2 + 4)-(x2 + 5, y2 + 8), _RGB32(0, 0, 0), BF
  353. _DELAY .004
  354. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 0, 0), BF
  355. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 0, 0), BF
  356. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 0, 0), BF
  357.  
  358. 'Keyboard control for your movement and shooting.
  359. keyboard:
  360. _LIMIT 1000
  361. a$ = INKEY$
  362. IF a$ = CHR$(27) THEN END
  363. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: l = 0
  364. IF r = 1 THEN
  365.     FOR sz = .25 TO 10 STEP .25
  366.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  367.     NEXT sz
  368.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  369.     xt = xt + 1
  370.     IF xt > 780 THEN xt = 780
  371.     FOR sz = .25 TO 10 STEP .25
  372.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  373.     NEXT sz
  374.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  375. IF a$ = CHR$(0) + CHR$(75) THEN l = 1: r = 0
  376. IF l = 1 THEN
  377.     FOR sz = .25 TO 10 STEP .25
  378.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  379.     NEXT sz
  380.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  381.     xt = xt - 1
  382.     IF xt < 0 THEN xt = 0
  383.     FOR sz = .25 TO 10 STEP .25
  384.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  385.     NEXT sz
  386.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  387. IF a$ = CHR$(0) + CHR$(72) OR a$ = CHR$(0) + CHR$(80) THEN
  388.     r = 0: l = 0
  389.  
  390. IF a$ = " " THEN GOSUB youshoot:
  391.  
  392. 'The start of your shot.
  393. youshoot:
  394. _LIMIT 1000
  395.  
  396. 'sx2 and sy2 are your shot coordinates.
  397. IF ushoot = 0 THEN
  398.     sx2 = xt + 10
  399.     sy2 = yt - 20
  400.     ushoot = 1
  401.     SOUND 400, .5
  402.  
  403. 'The drawing and movement of your shot and if it reaches the enemy.
  404. youshoot2:
  405. _LIMIT 1000
  406. IF ushoot = 1 THEN
  407.     FOR sz = .25 TO 5 STEP .25
  408.         CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  409.     NEXT sz
  410.     sy2 = sy2 - 3
  411.     IF sy2 < 0 THEN ushoot = 0: RETURN
  412.     FOR szz = .25 TO 5 STEP .25
  413.         CIRCLE (sx2, sy2), szz, _RGB32(255, 0, 0)
  414.     NEXT szz
  415.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 0 THEN
  416.         ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  417.         FOR sz = .25 TO 5 STEP .25
  418.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  419.         NEXT sz
  420.         points = points + 100
  421.         e1 = 1
  422.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  423.             level = level + 1
  424.             level2 = level2 + 1
  425.             e1 = 0: E2 = 0: e3 = 0
  426.         END IF
  427.         lives$ = STR$(lives)
  428.         points$ = STR$(points)
  429.         level$ = STR$(level2)
  430.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  431.         ushoot = 0
  432.         GOTO go:
  433.     END IF
  434.     IF sx2 > x5 - 21 AND sx2 < x5 + 41 AND sy2 > y5 - 11 AND sy2 < y5 + 21 AND E2 = 0 AND boss = 0 THEN
  435.         ENEMYEXPLOSION2 sx2, sy2, x5, y5, sx3, sy3
  436.         FOR sz = .25 TO 5 STEP .25
  437.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  438.         NEXT sz
  439.         points = points + 100
  440.         E2 = 1
  441.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  442.             level = level + 1
  443.             level2 = level2 + 1
  444.             e1 = 0: E2 = 0: e3 = 0
  445.         END IF
  446.         lives$ = STR$(lives)
  447.         points$ = STR$(points)
  448.         level$ = STR$(level2)
  449.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  450.         ushoot = 0
  451.         GOTO go:
  452.     END IF
  453.     IF sx2 > x6 - 21 AND sx2 < x6 + 41 AND sy2 > y6 - 11 AND sy2 < y6 + 21 AND e3 = 0 AND boss = 0 THEN
  454.         ENEMYEXPLOSION3 sx2, sy2, x6, y6, sx4, sy4
  455.         FOR sz = .25 TO 5 STEP .25
  456.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  457.         NEXT sz
  458.         points = points + 100
  459.         e3 = 1
  460.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  461.             level = level + 1
  462.             level2 = level2 + 1
  463.             e1 = 0: E2 = 0: e3 = 0
  464.         END IF
  465.         lives$ = STR$(lives)
  466.         points$ = STR$(points)
  467.         level$ = STR$(level2)
  468.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  469.         ushoot = 0
  470.         GOTO go:
  471.     END IF
  472.  
  473.     'To see if you hit the Boss.
  474.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 1 THEN
  475.         B = B + 1
  476.         BB = 10 - B
  477.         LOCATE 3, 3: PRINT "BOSS ROBOT:"
  478.         IF bx = 0 THEN GOTO bxx:
  479.         LINE (150, 30)-(bx + 150, 50), _RGB32(0, 0, 0), BF
  480.         bxx:
  481.         bx = BB * 10
  482.         IF bx < 0 THEN GOTO bxx2:
  483.         LINE (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF
  484.         bxx2:
  485.         SOUND 100, 1
  486.         points = points + 100
  487.         lives$ = STR$(lives)
  488.         points$ = STR$(points)
  489.         level$ = STR$(level2)
  490.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  491.         FOR sz = .25 TO 5 STEP .25
  492.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  493.         NEXT sz
  494.         IF B > 10 THEN ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  495.         IF B < 11 THEN ushoot = 0: RETURN
  496.         LINE (0, 0)-(800, 200), _RGB32(0, 0, 0), BF
  497.         bx = 0
  498.         BB = 0
  499.         B = 0
  500.         boss = 0
  501.         points = points + 1000
  502.         level = level + 1
  503.         level2 = level2 + 1
  504.         e1 = 0: E2 = 0: e3 = 0
  505.         lives$ = STR$(lives)
  506.         points$ = STR$(points)
  507.         level$ = STR$(level2)
  508.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  509.         ushoot = 0
  510.         GOTO go:
  511.     END IF
  512.  
  513. 'The enemy's shot and if it reaches you.
  514. shoot:
  515. _LIMIT 1000
  516. IF shooting = 0 AND e1 = 0 THEN
  517.     GOSUB checktoshoot:
  518.     sh = INT(RND * 10000) + 1
  519.     IF sh < shh THEN GOTO nexone:
  520.  
  521.     'sx and sy are the first enemy shot coordinates.
  522.     sx = x2 + 10
  523.     sy = y2 + 10
  524.     shooting = 1
  525.     SOUND 300, .5
  526. nexone:
  527. IF shooting2 = 0 AND E2 = 0 THEN
  528.     GOSUB checktoshoot:
  529.     sh2 = INT(RND * 10000) + 1
  530.     IF sh2 < shh THEN GOTO nexone2:
  531.  
  532.     'sx3 and sy3 are the second enemy shot coordinates.
  533.     sx3 = x5 + 10
  534.     sy3 = y5 + 10
  535.     shooting2 = 1
  536.     SOUND 300, .5
  537. nexone2:
  538. IF shooting3 = 0 AND e3 = 0 THEN
  539.     GOSUB checktoshoot:
  540.     sh3 = INT(RND * 10000) + 1
  541.     IF sh3 < shh THEN GOTO nexone3:
  542.  
  543.     'sx4 and sy4 are the third enemy shot coordinates.
  544.     sx4 = x6 + 10
  545.     sy4 = y6 + 10
  546.     shooting3 = 1
  547.     SOUND 300, .5
  548.  
  549. nexone3:
  550. 'To see if first enemy hit you.
  551. IF shooting = 1 AND e1 = 0 THEN
  552.     FOR sz2 = .25 TO 5 STEP .25
  553.         CIRCLE (sx, sy), sz2, _RGB32(0, 0, 0)
  554.     NEXT sz2
  555.     sy = sy + 3
  556.     IF sy > 620 THEN shooting = 0: GOTO nex4:
  557.     FOR szz2 = .25 TO 5 STEP .25
  558.         CIRCLE (sx, sy), szz2, _RGB32(255, 0, 0)
  559.     NEXT szz2
  560.     IF sx > xt - 1 AND sx < xt + 21 AND sy > yt - 1 AND sy < yt + 21 THEN
  561.         FOR sz3 = .25 TO 5 STEP .25
  562.             CIRCLE (sx, sy), sz3, _RGB32(0, 0, 0)
  563.         NEXT sz3
  564.         shooting = 0
  565.         GOSUB explosion:
  566.     END IF
  567. nex4:
  568.  
  569. 'To see if second enemy hit you.
  570. IF shooting2 = 1 AND E2 = 0 THEN
  571.     FOR sz2 = .25 TO 5 STEP .25
  572.         CIRCLE (sx3, sy3), sz2, _RGB32(0, 0, 0)
  573.     NEXT sz2
  574.     sy3 = sy3 + 3
  575.     IF sy3 > 620 THEN shooting2 = 0: GOTO nexx:
  576.     FOR szz2 = .25 TO 5 STEP .25
  577.         CIRCLE (sx3, sy3), szz2, _RGB32(255, 0, 0)
  578.     NEXT szz2
  579.     IF sx3 > xt - 1 AND sx3 < xt + 21 AND sy3 > yt - 1 AND sy3 < yt + 21 THEN
  580.         FOR sz3 = .25 TO 5 STEP .25
  581.             CIRCLE (sx3, sy3), sz3, _RGB32(0, 0, 0)
  582.         NEXT sz3
  583.         shooting2 = 0
  584.         GOSUB explosion:
  585.     END IF
  586.  
  587. nexx:
  588. 'To see if third enemy hit you.
  589. IF shooting3 = 1 AND e3 = 0 THEN
  590.     FOR sz2 = .25 TO 5 STEP .25
  591.         CIRCLE (sx4, sy4), sz2, _RGB32(0, 0, 0)
  592.     NEXT sz2
  593.     sy4 = sy4 + 3
  594.     IF sy4 > 620 THEN shooting3 = 0: RETURN
  595.     FOR szz2 = .25 TO 5 STEP .25
  596.         CIRCLE (sx4, sy4), szz2, _RGB32(255, 0, 0)
  597.     NEXT szz2
  598.     IF sx4 > xt - 1 AND sx4 < xt + 21 AND sy4 > yt - 1 AND sy4 < yt + 21 THEN
  599.         FOR sz3 = .25 TO 5 STEP .25
  600.             CIRCLE (sx4, sy4), sz3, _RGB32(0, 0, 0)
  601.         NEXT sz3
  602.         shooting3 = 0
  603.         GOSUB explosion:
  604.     END IF
  605.  
  606.  
  607. explosion:
  608. SOUND 200, 1
  609. SOUND 100, 1
  610. FOR explosion2 = 1 TO 30
  611.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(255, 0, 0)
  612.     _DELAY .02
  613.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(0, 0, 0)
  614. NEXT explosion2
  615. lives = lives - 1
  616. lives$ = STR$(lives)
  617. points$ = STR$(points)
  618. level$ = STR$(level2)
  619. _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  620. LINE (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF
  621. IF lives = 0 THEN
  622.     LOCATE 20, 40: PRINT "G A M E   O V E R"
  623.     LOCATE 22, 40: PRINT "Score: "; points
  624.     LOCATE 23, 40: PRINT "Level: "; level2
  625.     LOCATE 25, 40: INPUT "Press Enter to go to Top Ten Scores.", tt$
  626.  
  627.     'Top Ten Scores
  628.     scc = points
  629.     IF _FILEEXISTS("toptentech.txt") THEN
  630.     ELSE
  631.         OPEN "toptentech.txt" FOR OUTPUT AS #1
  632.         RESTORE originaltopten
  633.         DO
  634.             READ toptenname$, toptenscore!
  635.             IF toptenname$ = "EOF" THEN EXIT DO
  636.             PRINT #1, toptenname$
  637.             PRINT #1, toptenscore!
  638.         LOOP
  639.         CLOSE #1
  640.     END IF
  641.  
  642.     OPEN "toptentech.txt" FOR INPUT AS #1
  643.     FOR n = 1 TO 10
  644.         INPUT #1, name$(n)
  645.         INPUT #1, score(n)
  646.         IF scc > score(n) AND sct = 0 THEN
  647.             NN = n
  648.             PRINT "You have made the Top Ten!"
  649.             typename:
  650.             INPUT "Type your name here (25 letters and spaces maximum.):", nm$(NN)
  651.             IF LEN(nm$(NN)) > 25 THEN
  652.                 PRINT "Name too long, try again."
  653.                 GOTO typename:
  654.             END IF
  655.             sccc(NN) = scc
  656.             sct = 1
  657.         END IF
  658.         IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  659.     NEXT n
  660.     CLOSE #1
  661.     nex5:
  662.     CLOSE #1
  663.     OPEN "toptentech.txt" FOR OUTPUT AS #1
  664.     FOR n = 1 TO NN
  665.         IF n <> NN THEN PRINT #1, name$(n): PRINT #1, score(n)
  666.         IF n = NN THEN
  667.             PRINT #1, nm$(n)
  668.             PRINT #1, sccc(n)
  669.         END IF
  670.     NEXT n
  671.     nex6:
  672.     FOR n = NN TO 10
  673.         PRINT #1, name$(n): PRINT #1, score(n)
  674.     NEXT n
  675.     CLOSE #1
  676.     nex7:
  677.     CLS
  678.     PRINT: PRINT: PRINT
  679.     PRINT "                                         T O P    T E N "
  680.     PRINT: PRINT: PRINT
  681.     OPEN "toptentech.txt" FOR INPUT AS #1
  682.     FOR n = 1 TO 10
  683.         IF EOF(1) THEN GOTO nex8:
  684.         INPUT #1, name$(n)
  685.         INPUT #1, score(n)
  686.         PRINT "             "; n; ". "; name$(n); score(n)
  687.     NEXT n
  688.     nex8:
  689.     CLOSE #1
  690.     FOR n = 1 TO 10
  691.         nm$(n) = ""
  692.         score(n) = 0
  693.         name$(n) = ""
  694.         sccc(n) = 0
  695.     NEXT n
  696.     NN = 0
  697.     n = 0
  698.     sct = 0
  699.     scc = 0
  700.     LOCATE 23, 1
  701.     INPUT "Would you like to play again? (Yes/No)", ag$
  702.     IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" OR ag$ = "YEs" THEN GOTO begin:
  703.     END
  704. OPENINGSOUND
  705.  
  706. checktoshoot:
  707. IF level2 = 1 THEN shh = 9950
  708. IF level2 = 2 THEN shh = 9945
  709. IF level2 = 3 THEN shh = 9940
  710. IF level2 = 4 THEN shh = 9935
  711. IF level2 = 5 THEN shh = 9930
  712. IF level2 = 6 THEN shh = 9925
  713. IF level2 > 6 THEN shh = 9920
  714.  
  715.  
  716.  
  717. originaltopten:
  718. DATA Space Ace,7000
  719. DATA Suzy Swift,6000
  720. DATA Speedy Spencer,5000
  721. DATA Super Sam,4000
  722. DATA Battery Bob,3000
  723. DATA Karen Kryptonite,2750
  724. DATA Quick Ken,2500
  725. DATA Tiger Tessa,2250
  726. DATA Arcade Joe,2000
  727. DATA How Do U Play,1750
  728.  
  729. SUB OPENINGSOUND
  730.     snd = 300
  731.     snd2 = 800
  732.     FOR t = 1 TO 50
  733.         IF snd > 800 THEN snd = 300
  734.         IF snd2 < 300 THEN snd2 = 800
  735.         snd = snd + 10
  736.         SOUND snd, .25
  737.     NEXT t
  738.  
  739. SUB ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy)
  740.     SOUND 200, 1
  741.     SOUND 100, 1
  742.     FOR sz4 = .25 TO 5 STEP .25
  743.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  744.     NEXT sz4
  745.     FOR explosion = 1 TO 30
  746.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(255, 0, 0)
  747.         _LIMIT 100
  748.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(0, 0, 0)
  749.     NEXT explosion
  750.     LINE (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF
  751.     FOR sz4 = .25 TO 5 STEP .25
  752.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  753.     NEXT sz4
  754.     FOR sz4 = .25 TO 5 STEP .25
  755.         CIRCLE (sx, sy), sz4, _RGB32(0, 0, 0)
  756.     NEXT sz4
  757.  
  758.  
  759. SUB ENEMYEXPLOSION2 (sx2, sy2, x5, y5, sx3, sy3)
  760.     SOUND 200, 1
  761.     SOUND 100, 1
  762.     FOR sz5 = .25 TO 5 STEP .25
  763.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  764.     NEXT sz5
  765.     FOR explosion = 1 TO 30
  766.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(255, 0, 0)
  767.         _LIMIT 100
  768.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(0, 0, 0)
  769.     NEXT explosion
  770.     LINE (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF
  771.     FOR sz5 = .25 TO 5 STEP .25
  772.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  773.     NEXT sz5
  774.     FOR sz5 = .25 TO 5 STEP .25
  775.         CIRCLE (sx3, sy3), sz5, _RGB32(0, 0, 0)
  776.     NEXT sz5
  777.  
  778.  
  779. SUB ENEMYEXPLOSION3 (sx2, sy2, x6, y6, sx4, sy4)
  780.     SOUND 200, 1
  781.     SOUND 100, 1
  782.     FOR sz6 = .25 TO 5 STEP .25
  783.         CIRCLE (sx2, sy2), sz6, _RGB32(0, 0, 0)
  784.     NEXT sz6
  785.     FOR explosion = 1 TO 30
  786.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(255, 0, 0)
  787.         _LIMIT 100
  788.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(0, 0, 0)
  789.     NEXT explosion
  790.     LINE (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF
  791.     FOR sz5 = .25 TO 5 STEP .25
  792.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  793.     NEXT sz5
  794.     FOR sz5 = .25 TO 5 STEP .25
  795.         CIRCLE (sx4, sy4), sz5, _RGB32(0, 0, 0)
  796.     NEXT sz5
  797.  
  798.  

« Last Edit: July 27, 2019, 04:35:00 pm by SierraKen »

Offline pforpond

  • Newbie
  • Posts: 76
  • I am me
    • View Profile
Re: Tech Invaders 2
« Reply #3 on: July 27, 2019, 02:38:11 am »
Theres some good improvements here, love that you have multiple enemies on screen at a time now! :)
Loading Signature...

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #4 on: July 27, 2019, 12:19:15 pm »
Thanks pforpond! Yeah it makes the game more interesting. :)

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tech Invaders 2
« Reply #5 on: July 27, 2019, 01:34:31 pm »
Nice! I got done in by the "Boss" robot, but I was trying to follow the progress bar, and all I saw was a red solid rectangle with no info in it.  I double-checked to make sure I had the latest 861 line version. I played a second time, and noticed the same thing. I beat the Boss that time, but no status info was ever displayed. One other strange glitch was after I was hit, the invaders appeared, but my shooter went stealth. I had to press arrow keys to get it to display again.

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tech Invaders 2
« Reply #6 on: July 27, 2019, 01:50:50 pm »
Nice! I got done in by the "Boss" robot, but I was trying to follow the progress bar, and all I saw was a red solid rectangle with no info in it.  I double-checked to make sure I had the latest 861 line version. I played a second time, and noticed the same thing. I beat the Boss that time, but no status info was ever displayed. One other strange glitch was after I was hit, the invaders appeared, but my shooter went stealth. I had to press arrow keys to get it to display again.

Pete

The red bar shrinks with each hit on the Boss (and for some reason the Boss has a narrower zone to hit, I guess that's why it is Boss).

Yes, I noticed the stealth mode too, too bad it only works against the player :D

I'd like to see my bullets and the enemies explode when they collide, no harm no foul to either shooter.
« Last Edit: July 27, 2019, 01:52:13 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #7 on: July 27, 2019, 04:19:33 pm »
Pete, as B+ said, there is nothing to read on the status bar, it just shrinks as you hit the enemy like other arcade games do.
Your shooter only disappears if you shoot the alien when he's on top of you pretty much, because his explosion erases your graphic at the same time. He doesn't disappear other times.

The explosion I just made it simple using a circle. I guess I could have made random particles shoot out everywhere, I might look into that, thanks.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tech Invaders 2
« Reply #8 on: July 27, 2019, 04:28:26 pm »
...Yes, but the shooter should reappear, and sometimes, like Mark also stated, it doesn't. The aliens just keep firing and your shooter is nowhere to be found, until you initiate a key press. It should be redrawn after it explodes, and before the aliens re-engage.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #9 on: July 27, 2019, 04:33:51 pm »
I just fixed it.... I think.... Please test this one and see if he doesn't reappear before you move, thanks.
And thank you for telling me about this.
Here is the fixed version:

(Note: One with particle explosions is after this one.)

Code: QB64: [Select]
  1. 'Tech Invaders 2
  2. 'Game made on July 26, 2019
  3. 'By Ken G.
  4. 'Freeware
  5. 'I have put some descriptions in the code below to make it easier to learn from.
  6. begin:
  7. DIM name$(50), nm$(50), score(50), sccc(50)
  8. _TITLE "Tech Invaders 2"
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. FOR tt = 79 TO 34 STEP -1
  11.     LOCATE 3, tt + 1: PRINT " "
  12.     LOCATE 3, tt: PRINT "T"
  13.     _DELAY .03
  14. NEXT tt
  15. FOR ee = 79 TO 36 STEP -1
  16.     LOCATE 3, ee + 1: PRINT " "
  17.     LOCATE 3, ee: PRINT "E"
  18.     _DELAY .03
  19. NEXT ee
  20. FOR cc = 79 TO 38 STEP -1
  21.     LOCATE 3, cc + 1: PRINT " "
  22.     LOCATE 3, cc: PRINT "C"
  23.     _DELAY .03
  24. NEXT cc
  25. FOR hh = 79 TO 40 STEP -1
  26.     LOCATE 3, hh + 1: PRINT " "
  27.     LOCATE 3, hh: PRINT "H"
  28.     _DELAY .03
  29. NEXT hh
  30. FOR II = 79 TO 47 STEP -1
  31.     LOCATE 3, II + 1: PRINT " "
  32.     LOCATE 3, II: PRINT "I"
  33.     _DELAY .03
  34. NEXT II
  35. FOR NN = 79 TO 49 STEP -1
  36.     LOCATE 3, NN + 1: PRINT " "
  37.     LOCATE 3, NN: PRINT "N"
  38.     _DELAY .03
  39. NEXT NN
  40. FOR VV = 79 TO 51 STEP -1
  41.     LOCATE 3, VV + 1: PRINT " "
  42.     LOCATE 3, VV: PRINT "V"
  43.     _DELAY .03
  44. NEXT VV
  45. FOR AA = 79 TO 53 STEP -1
  46.     LOCATE 3, AA + 1: PRINT " "
  47.     LOCATE 3, AA: PRINT "A"
  48.     _DELAY .03
  49. NEXT AA
  50. FOR DD = 79 TO 55 STEP -1
  51.     LOCATE 3, DD + 1: PRINT " "
  52.     LOCATE 3, DD: PRINT "D"
  53.     _DELAY .03
  54. NEXT DD
  55. FOR EE2 = 79 TO 57 STEP -1
  56.     LOCATE 3, EE2 + 1: PRINT " "
  57.     LOCATE 3, EE2: PRINT "E"
  58.     _DELAY .03
  59. NEXT EE2
  60. FOR RR = 79 TO 59 STEP -1
  61.     LOCATE 3, RR + 1: PRINT " "
  62.     LOCATE 3, RR: PRINT "R"
  63.     _DELAY .03
  64. NEXT RR
  65. FOR ss = 79 TO 61 STEP -1
  66.     LOCATE 3, ss + 1: PRINT " "
  67.     LOCATE 3, ss: PRINT "S"
  68.     _DELAY .03
  69. NEXT ss
  70. PRINT "                                         T W O"
  71. PRINT "                                        by Ken G."
  72. PRINT "                       Use left and right arrow keys to move back and forth."
  73. PRINT "                            Use up or down arrow keys to stop moving."
  74. PRINT "                                    Use space bar to fire."
  75. PRINT "                                      Esc to end anytime."
  76. INPUT "                                   Press Enter to start.", start$
  77. e1 = 0
  78. E2 = 0
  79. e3 = 0
  80. lives = 5
  81. points = 0
  82. ushoot = 0
  83. shooting = 0
  84. level = 1
  85. level2 = 1
  86. start = 0
  87. s = 0
  88. xt = 400
  89. yt = 560
  90. B = 0
  91. boss = 0
  92.  
  93. 'Draw your shooter.
  94. FOR sz = .25 TO 10 STEP .25
  95.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  96. NEXT sz
  97. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  98.  
  99. OPENINGSOUND
  100.  
  101. 'This is the start of the main loop.
  102. go:
  103. 'Choose a random place for the enemy.
  104.  
  105. IF e1 = 0 AND E2 = 0 AND e3 = 0 THEN
  106.     xx = INT(RND * 200) + 100
  107.     yy = INT(RND * 100) + 40
  108.     xx2 = INT(RND * 200) + 200
  109.     yy2 = INT(RND * 100) + 40
  110.     xx3 = INT(RND * 200) + 250
  111.     yy3 = INT(RND * 100) + 40
  112.  
  113. 'Each level has its own loop so it can set a different equation and speed of the enemy.
  114.  
  115. IF level = 1 THEN
  116.     c1 = 128: c2 = 127: c3 = 255
  117.     one:
  118.     'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed.
  119.     sec = sec + .02
  120.     s = (60 - sec) * 6 + 180
  121.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  122.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  123.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  124.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  125.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  126.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  127.  
  128.     'GOSUB to drawing draws the enemy robot.
  129.     IF e1 <> 1 THEN GOSUB drawing:
  130.     IF E2 <> 1 THEN GOSUB drawing3:
  131.     IF e3 <> 1 THEN GOSUB drawing4:
  132.     _DELAY .006
  133.     GOSUB erase:
  134.     IF sec > 180 THEN
  135.         sec = 0
  136.         GOTO onedone:
  137.     END IF
  138.  
  139.     'GOSUB's go to keyboard control and enemy shooting.
  140.     GOSUB keyboard:
  141.     GOSUB shoot:
  142.     GOSUB youshoot2:
  143.     GOTO one:
  144.     onedone:
  145.  
  146. 'This level uses the spiral equation so it's a bit different than the others.
  147. IF level = 2 THEN
  148.     c1 = 127: c2 = 216: c3 = 127
  149.     xx = 400: yy = 300
  150.     xx2 = 100: yy2 = 300
  151.     xx3 = 600: yy3 = 300
  152.     FOR D = 160 TO 0 STEP -.125
  153.         _LIMIT 1000
  154.         s = s + .2
  155.         x = COS(s * 3.141592 / 180) * D
  156.         y = SIN(s * 3.151492 / 180) * D
  157.         x3 = COS(s * 3.141592 / 180) * D
  158.         y3 = SIN(s * 3.151492 / 180) * D
  159.         x4 = COS(s * 3.141592 / 180) * D
  160.         y4 = SIN(s * 3.151492 / 180) * D
  161.         IF e1 <> 1 THEN GOSUB drawing:
  162.         IF E2 <> 1 THEN GOSUB drawing3:
  163.         IF e3 <> 1 THEN GOSUB drawing4:
  164.         _DELAY .006
  165.         GOSUB erase:
  166.         GOSUB keyboard:
  167.         GOSUB shoot:
  168.         GOSUB youshoot2:
  169.     NEXT D
  170.     FOR D = 0 TO 160 STEP .125
  171.         _LIMIT 1000
  172.         s = s - .2
  173.         x = COS(s * 3.141592 / 180) * D
  174.         y = SIN(s * 3.151492 / 180) * D
  175.         x3 = COS(s * 3.141592 / 180) * D
  176.         y3 = SIN(s * 3.151492 / 180) * D
  177.         x4 = COS(s * 3.141592 / 180) * D
  178.         y4 = SIN(s * 3.151492 / 180) * D
  179.         IF e1 <> 1 THEN GOSUB drawing:
  180.         IF E2 <> 1 THEN GOSUB drawing3:
  181.         IF e3 <> 1 THEN GOSUB drawing4:
  182.         _DELAY .006
  183.         GOSUB erase:
  184.         GOSUB keyboard:
  185.         GOSUB shoot:
  186.         GOSUB youshoot2:
  187.     NEXT D
  188.  
  189. IF level = 3 THEN
  190.     c1 = 255: c2 = 0: c3 = 0
  191.     three:
  192.     sec = sec + .02
  193.     s = (60 - sec) * 6 + 180
  194.     x = INT(SIN(s / 90 * 3.141592) * 180) + 325
  195.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  196.     x3 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  197.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  198.     x4 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  199.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  200.     IF e1 <> 1 THEN GOSUB drawing:
  201.     IF E2 <> 1 THEN GOSUB drawing3:
  202.     IF e3 <> 1 THEN GOSUB drawing4:
  203.     _DELAY .006
  204.     GOSUB erase:
  205.     IF sec > 60 THEN
  206.         sec = 0
  207.         GOTO threedone:
  208.     END IF
  209.     GOSUB keyboard:
  210.     GOSUB shoot:
  211.     GOSUB youshoot2:
  212.     GOTO three:
  213.     threedone:
  214.  
  215. IF level = 4 THEN
  216.     c1 = 255: c2 = 255: c3 = 127
  217.     four:
  218.     sec = sec + .02
  219.     s = (60 - sec) * 6 + 180
  220.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  221.     y = INT(COS(s / 90 * 3.141592) * 180) + 225
  222.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  223.     y3 = INT(COS(s / 90 * 3.141592) * 180) + 225
  224.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  225.     y4 = INT(COS(s / 90 * 3.141592) * 180) + 225
  226.     IF e1 <> 1 THEN GOSUB drawing:
  227.     IF E2 <> 1 THEN GOSUB drawing3:
  228.     IF e3 <> 1 THEN GOSUB drawing4:
  229.     _DELAY .006
  230.     GOSUB erase:
  231.     IF sec > 60 THEN
  232.         sec = 0
  233.         GOTO fourdone:
  234.     END IF
  235.     GOSUB keyboard:
  236.     GOSUB shoot:
  237.     GOSUB youshoot2:
  238.     GOTO four:
  239.     fourdone:
  240. IF level = 5 THEN
  241.     c1 = 133: c2 = 28: c3 = 255
  242.     five:
  243.     sec = sec + .02
  244.     s = (60 - sec) * 6 + 180
  245.     x = INT(SIN(s / 135 * 3.141592) * 180) + 325
  246.     y = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  247.     x3 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  248.     y3 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  249.     x4 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  250.     y4 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  251.     IF e1 <> 1 THEN GOSUB drawing:
  252.     IF E2 <> 1 THEN GOSUB drawing3:
  253.     IF e3 <> 1 THEN GOSUB drawing4:
  254.     _DELAY .006
  255.     GOSUB erase:
  256.     IF sec > 60 THEN
  257.         sec = 0
  258.         GOTO fivedone:
  259.     END IF
  260.     GOSUB keyboard:
  261.     GOSUB shoot:
  262.     GOSUB youshoot2:
  263.     GOTO five:
  264.     fivedone:
  265.  
  266. IF level = 6 THEN
  267.     e1 = 0: E2 = 1: e3 = 1
  268.     boss = 1
  269.     c1 = 255: c2 = 0: c3 = 0
  270.     six:
  271.     sec = sec + .02
  272.     s = (60 - sec) * 6 + 180
  273.     x = INT(SIN(s / 45 * 3.141592) * 180) + 325
  274.     y = INT(COS(s / 360 * 3.141592) * 180) + 225
  275.     GOSUB drawing2:
  276.     IF sec > 120 THEN
  277.         sec = 0
  278.         GOTO sixdone:
  279.     END IF
  280.     GOSUB keyboard:
  281.     GOSUB shoot:
  282.     GOSUB youshoot2:
  283.     GOTO six:
  284.     sixdone:
  285.  
  286. IF level = 7 THEN level = 1
  287.  
  288. GOTO go:
  289. 'GOTO goes back to the start of the main loop.
  290.  
  291. 'Draws the enemy tank and erases it for animation.
  292. drawing:
  293. x2 = x + xx: y2 = y + yy
  294.  
  295. FOR t = 15 TO 20 STEP .25
  296.     CIRCLE (x2, y2), t, _RGB32(0, 255, 255)
  297. FOR t = .25 TO 15 STEP .25
  298.     CIRCLE (x2, y2), t, _RGB32(c1, c2, c3)
  299. FOR t = .25 TO 3 STEP .25
  300.     CIRCLE (x2 - 10, y2 - 5), t, _RGB32(0, 255, 255)
  301.     CIRCLE (x2 + 10, y2 - 5), t, _RGB32(0, 255, 255)
  302.     CIRCLE (x2, y2 + 10), t, _RGB32(0, 255, 255)
  303.  
  304.  
  305. drawing3:
  306. x5 = x3 + xx2: y5 = y3 + yy2
  307.  
  308. FOR t = 15 TO 20 STEP .25
  309.     CIRCLE (x5, y5), t, _RGB32(0, 255, 255)
  310. FOR t = .25 TO 15 STEP .25
  311.     CIRCLE (x5, y5), t, _RGB32(c1, c2, c3)
  312. FOR t = .25 TO 3 STEP .25
  313.     CIRCLE (x5 - 10, y5 - 5), t, _RGB32(0, 255, 255)
  314.     CIRCLE (x5 + 10, y5 - 5), t, _RGB32(0, 255, 255)
  315.     CIRCLE (x5, y5 + 10), t, _RGB32(0, 255, 255)
  316.  
  317. drawing4:
  318. x6 = x4 + xx3: y6 = y4 + yy3
  319.  
  320. FOR t = 15 TO 20 STEP .25
  321.     CIRCLE (x6, y6), t, _RGB32(0, 255, 255)
  322. FOR t = .25 TO 15 STEP .25
  323.     CIRCLE (x6, y6), t, _RGB32(c1, c2, c3)
  324. FOR t = .25 TO 3 STEP .25
  325.     CIRCLE (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255)
  326.     CIRCLE (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255)
  327.     CIRCLE (x6, y6 + 10), t, _RGB32(0, 255, 255)
  328.  
  329. IF e1 = 0 THEN
  330.     FOR t = .25 TO 20 STEP .25
  331.         CIRCLE (x2, y2), t, _RGB32(0, 0, 0)
  332.     NEXT t
  333. IF E2 = 0 THEN
  334.     FOR t = .25 TO 20 STEP .25
  335.         CIRCLE (x5, y5), t, _RGB32(0, 0, 0)
  336.     NEXT t
  337. IF e3 = 0 THEN
  338.     FOR t = .25 TO 20 STEP .25
  339.         CIRCLE (x6, y6), t, _RGB32(0, 0, 0)
  340.     NEXT t
  341.  
  342. 'Draws the Boss Robot.
  343. drawing2:
  344. x2 = x + xx: y2 = y + yy
  345. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 255, 0), BF
  346. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 255, 0), BF
  347. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 255, 0), BF
  348. FOR sz = .25 TO 3 STEP .25
  349.     CIRCLE (x2 - 5, y2 - 5), sz, _RGB32(0, 0, 0)
  350.     CIRCLE (x2 + 5, y2 - 5), sz, _RGB32(0, 0, 0)
  351. NEXT sz
  352. LINE (x2 - 5, y2 + 4)-(x2 + 5, y2 + 8), _RGB32(0, 0, 0), BF
  353. _DELAY .004
  354. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 0, 0), BF
  355. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 0, 0), BF
  356. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 0, 0), BF
  357.  
  358. 'Keyboard control for your movement and shooting.
  359. keyboard:
  360. _LIMIT 1000
  361. a$ = INKEY$
  362. IF a$ = CHR$(27) THEN END
  363. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: l = 0
  364. IF r = 1 THEN
  365.     FOR sz = .25 TO 10 STEP .25
  366.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  367.     NEXT sz
  368.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  369.     xt = xt + 1
  370.     IF xt > 780 THEN xt = 780
  371.     FOR sz = .25 TO 10 STEP .25
  372.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  373.     NEXT sz
  374.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  375. IF a$ = CHR$(0) + CHR$(75) THEN l = 1: r = 0
  376. IF l = 1 THEN
  377.     FOR sz = .25 TO 10 STEP .25
  378.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  379.     NEXT sz
  380.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  381.     xt = xt - 1
  382.     IF xt < 0 THEN xt = 0
  383.     FOR sz = .25 TO 10 STEP .25
  384.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  385.     NEXT sz
  386.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  387. IF a$ = CHR$(0) + CHR$(72) OR a$ = CHR$(0) + CHR$(80) THEN
  388.     r = 0: l = 0
  389.  
  390. IF a$ = " " THEN GOSUB youshoot:
  391.  
  392. 'The start of your shot.
  393. youshoot:
  394. _LIMIT 1000
  395.  
  396. 'sx2 and sy2 are your shot coordinates.
  397. IF ushoot = 0 THEN
  398.     sx2 = xt + 10
  399.     sy2 = yt - 20
  400.     ushoot = 1
  401.     SOUND 400, .5
  402.  
  403. 'The drawing and movement of your shot and if it reaches the enemy.
  404. youshoot2:
  405. _LIMIT 1000
  406. IF ushoot = 1 THEN
  407.     FOR sz = .25 TO 5 STEP .25
  408.         CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  409.     NEXT sz
  410.     sy2 = sy2 - 3
  411.     IF sy2 < 0 THEN ushoot = 0: RETURN
  412.     FOR szz = .25 TO 5 STEP .25
  413.         CIRCLE (sx2, sy2), szz, _RGB32(255, 0, 0)
  414.     NEXT szz
  415.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 0 THEN
  416.         ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  417.         FOR sz = .25 TO 5 STEP .25
  418.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  419.         NEXT sz
  420.         GOSUB redrawshooter:
  421.         points = points + 100
  422.         e1 = 1
  423.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  424.             level = level + 1
  425.             level2 = level2 + 1
  426.             e1 = 0: E2 = 0: e3 = 0
  427.         END IF
  428.         lives$ = STR$(lives)
  429.         points$ = STR$(points)
  430.         level$ = STR$(level2)
  431.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  432.         ushoot = 0
  433.         GOTO go:
  434.     END IF
  435.     IF sx2 > x5 - 21 AND sx2 < x5 + 41 AND sy2 > y5 - 11 AND sy2 < y5 + 21 AND E2 = 0 AND boss = 0 THEN
  436.         ENEMYEXPLOSION2 sx2, sy2, x5, y5, sx3, sy3
  437.         FOR sz = .25 TO 5 STEP .25
  438.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  439.         NEXT sz
  440.         GOSUB redrawshooter:
  441.         points = points + 100
  442.         E2 = 1
  443.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  444.             level = level + 1
  445.             level2 = level2 + 1
  446.             e1 = 0: E2 = 0: e3 = 0
  447.         END IF
  448.         lives$ = STR$(lives)
  449.         points$ = STR$(points)
  450.         level$ = STR$(level2)
  451.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  452.         ushoot = 0
  453.         GOTO go:
  454.     END IF
  455.     IF sx2 > x6 - 21 AND sx2 < x6 + 41 AND sy2 > y6 - 11 AND sy2 < y6 + 21 AND e3 = 0 AND boss = 0 THEN
  456.         ENEMYEXPLOSION3 sx2, sy2, x6, y6, sx4, sy4
  457.         FOR sz = .25 TO 5 STEP .25
  458.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  459.         NEXT sz
  460.         GOSUB redrawshooter:
  461.         points = points + 100
  462.         e3 = 1
  463.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  464.             level = level + 1
  465.             level2 = level2 + 1
  466.             e1 = 0: E2 = 0: e3 = 0
  467.         END IF
  468.         lives$ = STR$(lives)
  469.         points$ = STR$(points)
  470.         level$ = STR$(level2)
  471.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  472.         ushoot = 0
  473.         GOTO go:
  474.     END IF
  475.  
  476.     'To see if you hit the Boss.
  477.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 1 THEN
  478.         B = B + 1
  479.         BB = 10 - B
  480.         LOCATE 3, 3: PRINT "BOSS ROBOT:"
  481.         IF bx = 0 THEN GOTO bxx:
  482.         LINE (150, 30)-(bx + 150, 50), _RGB32(0, 0, 0), BF
  483.         bxx:
  484.         bx = BB * 10
  485.         IF bx < 0 THEN GOTO bxx2:
  486.         LINE (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF
  487.         bxx2:
  488.         SOUND 100, 1
  489.         points = points + 100
  490.         lives$ = STR$(lives)
  491.         points$ = STR$(points)
  492.         level$ = STR$(level2)
  493.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  494.         FOR sz = .25 TO 5 STEP .25
  495.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  496.         NEXT sz
  497.         IF B > 10 THEN ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  498.         IF B < 11 THEN ushoot = 0: RETURN
  499.         LINE (0, 0)-(800, 200), _RGB32(0, 0, 0), BF
  500.         GOSUB redrawshooter:
  501.         bx = 0
  502.         BB = 0
  503.         B = 0
  504.         boss = 0
  505.         points = points + 1000
  506.         level = level + 1
  507.         level2 = level2 + 1
  508.         e1 = 0: E2 = 0: e3 = 0
  509.         lives$ = STR$(lives)
  510.         points$ = STR$(points)
  511.         level$ = STR$(level2)
  512.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  513.         ushoot = 0
  514.         GOTO go:
  515.     END IF
  516.  
  517. redrawshooter:
  518. FOR sz = .25 TO 10 STEP .25
  519.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  520. NEXT sz
  521. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  522.  
  523.  
  524. 'The enemy's shot and if it reaches you.
  525. shoot:
  526. _LIMIT 1000
  527. IF shooting = 0 AND e1 = 0 THEN
  528.     GOSUB checktoshoot:
  529.     sh = INT(RND * 10000) + 1
  530.     IF sh < shh THEN GOTO nexone:
  531.  
  532.     'sx and sy are the first enemy shot coordinates.
  533.     sx = x2 + 10
  534.     sy = y2 + 10
  535.     shooting = 1
  536.     SOUND 300, .5
  537. nexone:
  538. IF shooting2 = 0 AND E2 = 0 THEN
  539.     GOSUB checktoshoot:
  540.     sh2 = INT(RND * 10000) + 1
  541.     IF sh2 < shh THEN GOTO nexone2:
  542.  
  543.     'sx3 and sy3 are the second enemy shot coordinates.
  544.     sx3 = x5 + 10
  545.     sy3 = y5 + 10
  546.     shooting2 = 1
  547.     SOUND 300, .5
  548. nexone2:
  549. IF shooting3 = 0 AND e3 = 0 THEN
  550.     GOSUB checktoshoot:
  551.     sh3 = INT(RND * 10000) + 1
  552.     IF sh3 < shh THEN GOTO nexone3:
  553.  
  554.     'sx4 and sy4 are the third enemy shot coordinates.
  555.     sx4 = x6 + 10
  556.     sy4 = y6 + 10
  557.     shooting3 = 1
  558.     SOUND 300, .5
  559.  
  560. nexone3:
  561. 'To see if first enemy hit you.
  562. IF shooting = 1 AND e1 = 0 THEN
  563.     FOR sz2 = .25 TO 5 STEP .25
  564.         CIRCLE (sx, sy), sz2, _RGB32(0, 0, 0)
  565.     NEXT sz2
  566.     sy = sy + 3
  567.     IF sy > 620 THEN shooting = 0: GOTO nex4:
  568.     FOR szz2 = .25 TO 5 STEP .25
  569.         CIRCLE (sx, sy), szz2, _RGB32(255, 0, 0)
  570.     NEXT szz2
  571.     IF sx > xt - 1 AND sx < xt + 21 AND sy > yt - 1 AND sy < yt + 21 THEN
  572.         FOR sz3 = .25 TO 5 STEP .25
  573.             CIRCLE (sx, sy), sz3, _RGB32(0, 0, 0)
  574.         NEXT sz3
  575.         shooting = 0
  576.         GOSUB explosion:
  577.     END IF
  578. nex4:
  579.  
  580. 'To see if second enemy hit you.
  581. IF shooting2 = 1 AND E2 = 0 THEN
  582.     FOR sz2 = .25 TO 5 STEP .25
  583.         CIRCLE (sx3, sy3), sz2, _RGB32(0, 0, 0)
  584.     NEXT sz2
  585.     sy3 = sy3 + 3
  586.     IF sy3 > 620 THEN shooting2 = 0: GOTO nexx:
  587.     FOR szz2 = .25 TO 5 STEP .25
  588.         CIRCLE (sx3, sy3), szz2, _RGB32(255, 0, 0)
  589.     NEXT szz2
  590.     IF sx3 > xt - 1 AND sx3 < xt + 21 AND sy3 > yt - 1 AND sy3 < yt + 21 THEN
  591.         FOR sz3 = .25 TO 5 STEP .25
  592.             CIRCLE (sx3, sy3), sz3, _RGB32(0, 0, 0)
  593.         NEXT sz3
  594.         shooting2 = 0
  595.         GOSUB explosion:
  596.     END IF
  597.  
  598. nexx:
  599. 'To see if third enemy hit you.
  600. IF shooting3 = 1 AND e3 = 0 THEN
  601.     FOR sz2 = .25 TO 5 STEP .25
  602.         CIRCLE (sx4, sy4), sz2, _RGB32(0, 0, 0)
  603.     NEXT sz2
  604.     sy4 = sy4 + 3
  605.     IF sy4 > 620 THEN shooting3 = 0: RETURN
  606.     FOR szz2 = .25 TO 5 STEP .25
  607.         CIRCLE (sx4, sy4), szz2, _RGB32(255, 0, 0)
  608.     NEXT szz2
  609.     IF sx4 > xt - 1 AND sx4 < xt + 21 AND sy4 > yt - 1 AND sy4 < yt + 21 THEN
  610.         FOR sz3 = .25 TO 5 STEP .25
  611.             CIRCLE (sx4, sy4), sz3, _RGB32(0, 0, 0)
  612.         NEXT sz3
  613.         shooting3 = 0
  614.         GOSUB explosion:
  615.     END IF
  616.  
  617.  
  618. explosion:
  619. SOUND 200, 1
  620. SOUND 100, 1
  621. FOR explosion2 = 1 TO 30
  622.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(255, 0, 0)
  623.     _DELAY .02
  624.     CIRCLE (xt + 10, yt + 10), explosion2, _RGB32(0, 0, 0)
  625. NEXT explosion2
  626. lives = lives - 1
  627. lives$ = STR$(lives)
  628. points$ = STR$(points)
  629. level$ = STR$(level2)
  630. _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  631. LINE (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF
  632. IF lives = 0 THEN
  633.     LOCATE 20, 40: PRINT "G A M E   O V E R"
  634.     LOCATE 22, 40: PRINT "Score: "; points
  635.     LOCATE 23, 40: PRINT "Level: "; level2
  636.     LOCATE 25, 40: INPUT "Press Enter to go to Top Ten Scores.", tt$
  637.  
  638.     'Top Ten Scores
  639.     scc = points
  640.     IF _FILEEXISTS("toptentech.txt") THEN
  641.     ELSE
  642.         OPEN "toptentech.txt" FOR OUTPUT AS #1
  643.         RESTORE originaltopten
  644.         DO
  645.             READ toptenname$, toptenscore!
  646.             IF toptenname$ = "EOF" THEN EXIT DO
  647.             PRINT #1, toptenname$
  648.             PRINT #1, toptenscore!
  649.         LOOP
  650.         CLOSE #1
  651.     END IF
  652.  
  653.     OPEN "toptentech.txt" FOR INPUT AS #1
  654.     FOR n = 1 TO 10
  655.         INPUT #1, name$(n)
  656.         INPUT #1, score(n)
  657.         IF scc > score(n) AND sct = 0 THEN
  658.             NN = n
  659.             PRINT "You have made the Top Ten!"
  660.             typename:
  661.             INPUT "Type your name here (25 letters and spaces maximum.):", nm$(NN)
  662.             IF LEN(nm$(NN)) > 25 THEN
  663.                 PRINT "Name too long, try again."
  664.                 GOTO typename:
  665.             END IF
  666.             sccc(NN) = scc
  667.             sct = 1
  668.         END IF
  669.         IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  670.     NEXT n
  671.     CLOSE #1
  672.     nex5:
  673.     CLOSE #1
  674.     OPEN "toptentech.txt" FOR OUTPUT AS #1
  675.     FOR n = 1 TO NN
  676.         IF n <> NN THEN PRINT #1, name$(n): PRINT #1, score(n)
  677.         IF n = NN THEN
  678.             PRINT #1, nm$(n)
  679.             PRINT #1, sccc(n)
  680.         END IF
  681.     NEXT n
  682.     nex6:
  683.     FOR n = NN TO 10
  684.         PRINT #1, name$(n): PRINT #1, score(n)
  685.     NEXT n
  686.     CLOSE #1
  687.     nex7:
  688.     CLS
  689.     PRINT: PRINT: PRINT
  690.     PRINT "                                         T O P    T E N "
  691.     PRINT: PRINT: PRINT
  692.     OPEN "toptentech.txt" FOR INPUT AS #1
  693.     FOR n = 1 TO 10
  694.         IF EOF(1) THEN GOTO nex8:
  695.         INPUT #1, name$(n)
  696.         INPUT #1, score(n)
  697.         PRINT "             "; n; ". "; name$(n); score(n)
  698.     NEXT n
  699.     nex8:
  700.     CLOSE #1
  701.     FOR n = 1 TO 10
  702.         nm$(n) = ""
  703.         score(n) = 0
  704.         name$(n) = ""
  705.         sccc(n) = 0
  706.     NEXT n
  707.     NN = 0
  708.     n = 0
  709.     sct = 0
  710.     scc = 0
  711.     LOCATE 23, 1
  712.     INPUT "Would you like to play again? (Yes/No)", ag$
  713.     IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" OR ag$ = "YEs" THEN GOTO begin:
  714.     END
  715. OPENINGSOUND
  716.  
  717. checktoshoot:
  718. IF level2 = 1 THEN shh = 9950
  719. IF level2 = 2 THEN shh = 9945
  720. IF level2 = 3 THEN shh = 9940
  721. IF level2 = 4 THEN shh = 9935
  722. IF level2 = 5 THEN shh = 9930
  723. IF level2 = 6 THEN shh = 9925
  724. IF level2 > 6 THEN shh = 9920
  725.  
  726.  
  727.  
  728. originaltopten:
  729. DATA Space Ace,7000
  730. DATA Suzy Swift,6000
  731. DATA Speedy Spencer,5000
  732. DATA Super Sam,4000
  733. DATA Battery Bob,3000
  734. DATA Karen Kryptonite,2750
  735. DATA Quick Ken,2500
  736. DATA Tiger Tessa,2250
  737. DATA Arcade Joe,2000
  738. DATA How Do U Play,1750
  739.  
  740. SUB OPENINGSOUND
  741.     snd = 300
  742.     snd2 = 800
  743.     FOR t = 1 TO 50
  744.         IF snd > 800 THEN snd = 300
  745.         IF snd2 < 300 THEN snd2 = 800
  746.         snd = snd + 10
  747.         SOUND snd, .25
  748.     NEXT t
  749.  
  750. SUB ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy)
  751.     SOUND 200, 1
  752.     SOUND 100, 1
  753.     FOR sz4 = .25 TO 5 STEP .25
  754.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  755.     NEXT sz4
  756.     FOR explosion = 1 TO 30
  757.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(255, 0, 0)
  758.         _LIMIT 100
  759.         CIRCLE (x2 + 10, y2 + 10), explosion, _RGB32(0, 0, 0)
  760.     NEXT explosion
  761.     LINE (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF
  762.     FOR sz4 = .25 TO 5 STEP .25
  763.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  764.     NEXT sz4
  765.     FOR sz4 = .25 TO 5 STEP .25
  766.         CIRCLE (sx, sy), sz4, _RGB32(0, 0, 0)
  767.     NEXT sz4
  768.  
  769.  
  770. SUB ENEMYEXPLOSION2 (sx2, sy2, x5, y5, sx3, sy3)
  771.     SOUND 200, 1
  772.     SOUND 100, 1
  773.     FOR sz5 = .25 TO 5 STEP .25
  774.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  775.     NEXT sz5
  776.     FOR explosion = 1 TO 30
  777.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(255, 0, 0)
  778.         _LIMIT 100
  779.         CIRCLE (x5 + 10, y5 + 10), explosion, _RGB32(0, 0, 0)
  780.     NEXT explosion
  781.     LINE (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF
  782.     FOR sz5 = .25 TO 5 STEP .25
  783.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  784.     NEXT sz5
  785.     FOR sz5 = .25 TO 5 STEP .25
  786.         CIRCLE (sx3, sy3), sz5, _RGB32(0, 0, 0)
  787.     NEXT sz5
  788.  
  789.  
  790. SUB ENEMYEXPLOSION3 (sx2, sy2, x6, y6, sx4, sy4)
  791.     SOUND 200, 1
  792.     SOUND 100, 1
  793.     FOR sz6 = .25 TO 5 STEP .25
  794.         CIRCLE (sx2, sy2), sz6, _RGB32(0, 0, 0)
  795.     NEXT sz6
  796.     FOR explosion = 1 TO 30
  797.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(255, 0, 0)
  798.         _LIMIT 100
  799.         CIRCLE (x6 + 10, y6 + 10), explosion, _RGB32(0, 0, 0)
  800.     NEXT explosion
  801.     LINE (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF
  802.     FOR sz5 = .25 TO 5 STEP .25
  803.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  804.     NEXT sz5
  805.     FOR sz5 = .25 TO 5 STEP .25
  806.         CIRCLE (sx4, sy4), sz5, _RGB32(0, 0, 0)
  807.     NEXT sz5
  808.  
« Last Edit: July 27, 2019, 06:40:39 pm by SierraKen »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tech Invaders 2
« Reply #10 on: July 27, 2019, 05:15:44 pm »
Nice, all fixed. I got to level 11 that time, and the progress bar works fine, now that I understand it.

Don't ever feel pressed about additions, but yes, it's good to let people know what to expect in terms of development.

That boss invader was a brilliant addition. He's a tough little s.o.b. (stubborn orbital being) but I was thinking if he was the whole game, well, the game would suck. It's the variation of using the others, at various attack intensities and then knowing at some level, you have to face the boss challenge to continue, well, it just works.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #11 on: July 27, 2019, 06:39:55 pm »
Thanks Pete! Well everything does loop after the Boss, even the colors, but it works good I think because it does get a little harder after the Boss and stays that timing of shots.

OK folks, I did it... I made particle explosions on all the enemies, as well as the shooter. :))) I can't believe how good this game has become since Day 1. Thanks for all your help.

This will be the last rendition. If I ever think of something incredibly wild to change, then I will make a Version 3, but not like tomorrow LOL.
Oh, and guess what? I broke the 1000 line mark! It's my first program I ever made to do that without an automatically generated program (I have a graphics program I made once that makes .BAS PSET lines, but it's almost useless since it makes the file so large lol).

(Note: The shooter disappears again, so I put another fix below on this page, sorry about that.)

Code: QB64: [Select]
  1. 'Tech Invaders 2
  2. 'Game made on July 27, 2019
  3. 'By Ken G.
  4. 'Freeware
  5. 'I have put some descriptions in the code below to make it easier to learn from.
  6. begin:
  7. DIM name$(50), nm$(50), score(50), sccc(50)
  8. _TITLE "Tech Invaders 2"
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. FOR tt = 79 TO 34 STEP -1
  11.     LOCATE 3, tt + 1: PRINT " "
  12.     LOCATE 3, tt: PRINT "T"
  13.     _DELAY .03
  14. NEXT tt
  15. FOR ee = 79 TO 36 STEP -1
  16.     LOCATE 3, ee + 1: PRINT " "
  17.     LOCATE 3, ee: PRINT "E"
  18.     _DELAY .03
  19. NEXT ee
  20. FOR cc = 79 TO 38 STEP -1
  21.     LOCATE 3, cc + 1: PRINT " "
  22.     LOCATE 3, cc: PRINT "C"
  23.     _DELAY .03
  24. NEXT cc
  25. FOR hh = 79 TO 40 STEP -1
  26.     LOCATE 3, hh + 1: PRINT " "
  27.     LOCATE 3, hh: PRINT "H"
  28.     _DELAY .03
  29. NEXT hh
  30. FOR II = 79 TO 47 STEP -1
  31.     LOCATE 3, II + 1: PRINT " "
  32.     LOCATE 3, II: PRINT "I"
  33.     _DELAY .03
  34. NEXT II
  35. FOR NN = 79 TO 49 STEP -1
  36.     LOCATE 3, NN + 1: PRINT " "
  37.     LOCATE 3, NN: PRINT "N"
  38.     _DELAY .03
  39. NEXT NN
  40. FOR VV = 79 TO 51 STEP -1
  41.     LOCATE 3, VV + 1: PRINT " "
  42.     LOCATE 3, VV: PRINT "V"
  43.     _DELAY .03
  44. NEXT VV
  45. FOR AA = 79 TO 53 STEP -1
  46.     LOCATE 3, AA + 1: PRINT " "
  47.     LOCATE 3, AA: PRINT "A"
  48.     _DELAY .03
  49. NEXT AA
  50. FOR DD = 79 TO 55 STEP -1
  51.     LOCATE 3, DD + 1: PRINT " "
  52.     LOCATE 3, DD: PRINT "D"
  53.     _DELAY .03
  54. NEXT DD
  55. FOR EE2 = 79 TO 57 STEP -1
  56.     LOCATE 3, EE2 + 1: PRINT " "
  57.     LOCATE 3, EE2: PRINT "E"
  58.     _DELAY .03
  59. NEXT EE2
  60. FOR RR = 79 TO 59 STEP -1
  61.     LOCATE 3, RR + 1: PRINT " "
  62.     LOCATE 3, RR: PRINT "R"
  63.     _DELAY .03
  64. NEXT RR
  65. FOR ss = 79 TO 61 STEP -1
  66.     LOCATE 3, ss + 1: PRINT " "
  67.     LOCATE 3, ss: PRINT "S"
  68.     _DELAY .03
  69. NEXT ss
  70. DD = 0
  71. PRINT "                                         T W O"
  72. PRINT "                                        by Ken G."
  73. PRINT "                       Use left and right arrow keys to move back and forth."
  74. PRINT "                            Use up or down arrow keys to stop moving."
  75. PRINT "                                    Use space bar to fire."
  76. PRINT "                                      Esc to end anytime."
  77. INPUT "                                   Press Enter to start.", start$
  78. e1 = 0
  79. E2 = 0
  80. e3 = 0
  81. lives = 5
  82. points = 0
  83. ushoot = 0
  84. shooting = 0
  85. level = 1
  86. level2 = 1
  87. start = 0
  88. s = 0
  89. xt = 400
  90. yt = 560
  91. B = 0
  92. boss = 0
  93.  
  94. 'Draw your shooter.
  95. FOR sz = .25 TO 10 STEP .25
  96.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  97. NEXT sz
  98. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  99.  
  100. OPENINGSOUND
  101.  
  102. 'This is the start of the main loop.
  103. go:
  104. 'Choose a random place for the enemy.
  105.  
  106. IF e1 = 0 AND E2 = 0 AND e3 = 0 THEN
  107.     xx = INT(RND * 200) + 100
  108.     yy = INT(RND * 100) + 40
  109.     xx2 = INT(RND * 200) + 200
  110.     yy2 = INT(RND * 100) + 40
  111.     xx3 = INT(RND * 200) + 250
  112.     yy3 = INT(RND * 100) + 40
  113.  
  114. 'Each level has its own loop so it can set a different equation and speed of the enemy.
  115.  
  116. IF level = 1 THEN
  117.     c1 = 128: c2 = 127: c3 = 255
  118.     one:
  119.     'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed.
  120.     sec = sec + .02
  121.     s = (60 - sec) * 6 + 180
  122.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  123.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  124.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  125.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  126.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  127.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  128.  
  129.     'GOSUB to drawing draws the enemy robot.
  130.     IF e1 <> 1 THEN GOSUB drawing:
  131.     IF E2 <> 1 THEN GOSUB drawing3:
  132.     IF e3 <> 1 THEN GOSUB drawing4:
  133.     _DELAY .006
  134.     GOSUB erase:
  135.     IF sec > 180 THEN
  136.         sec = 0
  137.         GOTO onedone:
  138.     END IF
  139.  
  140.     'GOSUB's go to keyboard control and enemy shooting.
  141.     GOSUB keyboard:
  142.     GOSUB shoot:
  143.     GOSUB youshoot2:
  144.     GOTO one:
  145.     onedone:
  146.  
  147. 'This level uses the spiral equation so it's a bit different than the others.
  148. IF level = 2 THEN
  149.     c1 = 127: c2 = 216: c3 = 127
  150.     xx = 400: yy = 300
  151.     xx2 = 100: yy2 = 300
  152.     xx3 = 600: yy3 = 300
  153.     FOR D = 160 TO 0 STEP -.125
  154.         _LIMIT 1000
  155.         s = s + .2
  156.         x = COS(s * 3.141592 / 180) * D
  157.         y = SIN(s * 3.151492 / 180) * D
  158.         x3 = COS(s * 3.141592 / 180) * D
  159.         y3 = SIN(s * 3.151492 / 180) * D
  160.         x4 = COS(s * 3.141592 / 180) * D
  161.         y4 = SIN(s * 3.151492 / 180) * D
  162.         IF e1 <> 1 THEN GOSUB drawing:
  163.         IF E2 <> 1 THEN GOSUB drawing3:
  164.         IF e3 <> 1 THEN GOSUB drawing4:
  165.         _DELAY .006
  166.         GOSUB erase:
  167.         GOSUB keyboard:
  168.         GOSUB shoot:
  169.         GOSUB youshoot2:
  170.     NEXT D
  171.     FOR D = 0 TO 160 STEP .125
  172.         _LIMIT 1000
  173.         s = s - .2
  174.         x = COS(s * 3.141592 / 180) * D
  175.         y = SIN(s * 3.151492 / 180) * D
  176.         x3 = COS(s * 3.141592 / 180) * D
  177.         y3 = SIN(s * 3.151492 / 180) * D
  178.         x4 = COS(s * 3.141592 / 180) * D
  179.         y4 = SIN(s * 3.151492 / 180) * D
  180.         IF e1 <> 1 THEN GOSUB drawing:
  181.         IF E2 <> 1 THEN GOSUB drawing3:
  182.         IF e3 <> 1 THEN GOSUB drawing4:
  183.         _DELAY .006
  184.         GOSUB erase:
  185.         GOSUB keyboard:
  186.         GOSUB shoot:
  187.         GOSUB youshoot2:
  188.     NEXT D
  189.  
  190. IF level = 3 THEN
  191.     c1 = 255: c2 = 0: c3 = 0
  192.     three:
  193.     sec = sec + .02
  194.     s = (60 - sec) * 6 + 180
  195.     x = INT(SIN(s / 90 * 3.141592) * 180) + 325
  196.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  197.     x3 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  198.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  199.     x4 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  200.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  201.     IF e1 <> 1 THEN GOSUB drawing:
  202.     IF E2 <> 1 THEN GOSUB drawing3:
  203.     IF e3 <> 1 THEN GOSUB drawing4:
  204.     _DELAY .006
  205.     GOSUB erase:
  206.     IF sec > 60 THEN
  207.         sec = 0
  208.         GOTO threedone:
  209.     END IF
  210.     GOSUB keyboard:
  211.     GOSUB shoot:
  212.     GOSUB youshoot2:
  213.     GOTO three:
  214.     threedone:
  215.  
  216. IF level = 4 THEN
  217.     c1 = 255: c2 = 255: c3 = 127
  218.     four:
  219.     sec = sec + .02
  220.     s = (60 - sec) * 6 + 180
  221.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  222.     y = INT(COS(s / 90 * 3.141592) * 180) + 225
  223.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  224.     y3 = INT(COS(s / 90 * 3.141592) * 180) + 225
  225.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  226.     y4 = INT(COS(s / 90 * 3.141592) * 180) + 225
  227.     IF e1 <> 1 THEN GOSUB drawing:
  228.     IF E2 <> 1 THEN GOSUB drawing3:
  229.     IF e3 <> 1 THEN GOSUB drawing4:
  230.     _DELAY .006
  231.     GOSUB erase:
  232.     IF sec > 60 THEN
  233.         sec = 0
  234.         GOTO fourdone:
  235.     END IF
  236.     GOSUB keyboard:
  237.     GOSUB shoot:
  238.     GOSUB youshoot2:
  239.     GOTO four:
  240.     fourdone:
  241. IF level = 5 THEN
  242.     c1 = 133: c2 = 28: c3 = 255
  243.     five:
  244.     sec = sec + .02
  245.     s = (60 - sec) * 6 + 180
  246.     x = INT(SIN(s / 135 * 3.141592) * 180) + 325
  247.     y = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  248.     x3 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  249.     y3 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  250.     x4 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  251.     y4 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  252.     IF e1 <> 1 THEN GOSUB drawing:
  253.     IF E2 <> 1 THEN GOSUB drawing3:
  254.     IF e3 <> 1 THEN GOSUB drawing4:
  255.     _DELAY .006
  256.     GOSUB erase:
  257.     IF sec > 60 THEN
  258.         sec = 0
  259.         GOTO fivedone:
  260.     END IF
  261.     GOSUB keyboard:
  262.     GOSUB shoot:
  263.     GOSUB youshoot2:
  264.     GOTO five:
  265.     fivedone:
  266.  
  267. IF level = 6 THEN
  268.     e1 = 0: E2 = 1: e3 = 1
  269.     boss = 1
  270.     c1 = 255: c2 = 0: c3 = 0
  271.     six:
  272.     sec = sec + .02
  273.     s = (60 - sec) * 6 + 180
  274.     x = INT(SIN(s / 45 * 3.141592) * 180) + 325
  275.     y = INT(COS(s / 360 * 3.141592) * 180) + 225
  276.     GOSUB drawing2:
  277.     IF sec > 120 THEN
  278.         sec = 0
  279.         GOTO sixdone:
  280.     END IF
  281.     GOSUB keyboard:
  282.     GOSUB shoot:
  283.     GOSUB youshoot2:
  284.     GOTO six:
  285.     sixdone:
  286. IF level = 7 THEN level = 1
  287. GOTO go:
  288. 'GOTO goes back to the start of the main loop.
  289.  
  290. 'Draws the enemy tank and erases it for animation.
  291. drawing:
  292. x2 = x + xx: y2 = y + yy
  293.  
  294. FOR t = 15 TO 20 STEP .25
  295.     CIRCLE (x2, y2), t, _RGB32(0, 255, 255)
  296. FOR t = .25 TO 15 STEP .25
  297.     CIRCLE (x2, y2), t, _RGB32(c1, c2, c3)
  298. FOR t = .25 TO 3 STEP .25
  299.     CIRCLE (x2 - 10, y2 - 5), t, _RGB32(0, 255, 255)
  300.     CIRCLE (x2 + 10, y2 - 5), t, _RGB32(0, 255, 255)
  301.     CIRCLE (x2, y2 + 10), t, _RGB32(0, 255, 255)
  302.  
  303. drawing3:
  304. x5 = x3 + xx2: y5 = y3 + yy2
  305.  
  306. FOR t = 15 TO 20 STEP .25
  307.     CIRCLE (x5, y5), t, _RGB32(0, 255, 255)
  308. FOR t = .25 TO 15 STEP .25
  309.     CIRCLE (x5, y5), t, _RGB32(c1, c2, c3)
  310. FOR t = .25 TO 3 STEP .25
  311.     CIRCLE (x5 - 10, y5 - 5), t, _RGB32(0, 255, 255)
  312.     CIRCLE (x5 + 10, y5 - 5), t, _RGB32(0, 255, 255)
  313.     CIRCLE (x5, y5 + 10), t, _RGB32(0, 255, 255)
  314.  
  315. drawing4:
  316. x6 = x4 + xx3: y6 = y4 + yy3
  317.  
  318. FOR t = 15 TO 20 STEP .25
  319.     CIRCLE (x6, y6), t, _RGB32(0, 255, 255)
  320. FOR t = .25 TO 15 STEP .25
  321.     CIRCLE (x6, y6), t, _RGB32(c1, c2, c3)
  322. FOR t = .25 TO 3 STEP .25
  323.     CIRCLE (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255)
  324.     CIRCLE (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255)
  325.     CIRCLE (x6, y6 + 10), t, _RGB32(0, 255, 255)
  326.  
  327. IF e1 = 0 THEN
  328.     FOR t = .25 TO 20 STEP .25
  329.         CIRCLE (x2, y2), t, _RGB32(0, 0, 0)
  330.     NEXT t
  331. IF E2 = 0 THEN
  332.     FOR t = .25 TO 20 STEP .25
  333.         CIRCLE (x5, y5), t, _RGB32(0, 0, 0)
  334.     NEXT t
  335. IF e3 = 0 THEN
  336.     FOR t = .25 TO 20 STEP .25
  337.         CIRCLE (x6, y6), t, _RGB32(0, 0, 0)
  338.     NEXT t
  339.  
  340. 'Draws the Boss Robot.
  341. drawing2:
  342. x2 = x + xx: y2 = y + yy
  343. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 255, 0), BF
  344. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 255, 0), BF
  345. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 255, 0), BF
  346. FOR sz = .25 TO 3 STEP .25
  347.     CIRCLE (x2 - 5, y2 - 5), sz, _RGB32(0, 0, 0)
  348.     CIRCLE (x2 + 5, y2 - 5), sz, _RGB32(0, 0, 0)
  349. NEXT sz
  350. LINE (x2 - 5, y2 + 4)-(x2 + 5, y2 + 8), _RGB32(0, 0, 0), BF
  351. _DELAY .004
  352. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 0, 0), BF
  353. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 0, 0), BF
  354. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 0, 0), BF
  355.  
  356. 'Keyboard control for your movement and shooting.
  357. keyboard:
  358. _LIMIT 1000
  359. a$ = INKEY$
  360. IF a$ = CHR$(27) THEN END
  361. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: l = 0
  362. IF r = 1 THEN
  363.     FOR sz = .25 TO 10 STEP .25
  364.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  365.     NEXT sz
  366.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  367.     xt = xt + 1
  368.     IF xt > 780 THEN xt = 780
  369.     FOR sz = .25 TO 10 STEP .25
  370.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  371.     NEXT sz
  372.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  373. IF a$ = CHR$(0) + CHR$(75) THEN l = 1: r = 0
  374. IF l = 1 THEN
  375.     FOR sz = .25 TO 10 STEP .25
  376.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  377.     NEXT sz
  378.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  379.     xt = xt - 1
  380.     IF xt < 0 THEN xt = 0
  381.     FOR sz = .25 TO 10 STEP .25
  382.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  383.     NEXT sz
  384.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  385. IF a$ = CHR$(0) + CHR$(72) OR a$ = CHR$(0) + CHR$(80) THEN
  386.     r = 0: l = 0
  387.  
  388. IF a$ = " " THEN GOSUB youshoot:
  389.  
  390. 'The start of your shot.
  391. youshoot:
  392. _LIMIT 1000
  393.  
  394. 'sx2 and sy2 are your shot coordinates.
  395. IF ushoot = 0 THEN
  396.     sx2 = xt + 10
  397.     sy2 = yt - 20
  398.     ushoot = 1
  399.     SOUND 400, .5
  400.  
  401. 'The drawing and movement of your shot and if it reaches the enemy.
  402. youshoot2:
  403. _LIMIT 1000
  404. IF ushoot = 1 THEN
  405.     FOR sz = .25 TO 5 STEP .25
  406.         CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  407.     NEXT sz
  408.     sy2 = sy2 - 3
  409.     IF sy2 < 0 THEN ushoot = 0: RETURN
  410.     FOR szz = .25 TO 5 STEP .25
  411.         CIRCLE (sx2, sy2), szz, _RGB32(255, 0, 0)
  412.     NEXT szz
  413.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 0 THEN
  414.         ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  415.         FOR sz = .25 TO 5 STEP .25
  416.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  417.         NEXT sz
  418.         GOSUB redrawshooter:
  419.         points = points + 100
  420.         e1 = 1
  421.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  422.             level = level + 1
  423.             level2 = level2 + 1
  424.             e1 = 0: E2 = 0: e3 = 0
  425.         END IF
  426.         lives$ = STR$(lives)
  427.         points$ = STR$(points)
  428.         level$ = STR$(level2)
  429.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  430.         ushoot = 0
  431.         GOTO go:
  432.     END IF
  433.     IF sx2 > x5 - 21 AND sx2 < x5 + 41 AND sy2 > y5 - 11 AND sy2 < y5 + 21 AND E2 = 0 AND boss = 0 THEN
  434.         ENEMYEXPLOSION2 sx2, sy2, x5, y5, sx3, sy3
  435.         FOR sz = .25 TO 5 STEP .25
  436.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  437.         NEXT sz
  438.         GOSUB redrawshooter:
  439.         points = points + 100
  440.         E2 = 1
  441.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  442.             level = level + 1
  443.             level2 = level2 + 1
  444.             e1 = 0: E2 = 0: e3 = 0
  445.         END IF
  446.         lives$ = STR$(lives)
  447.         points$ = STR$(points)
  448.         level$ = STR$(level2)
  449.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  450.         ushoot = 0
  451.         GOTO go:
  452.     END IF
  453.     IF sx2 > x6 - 21 AND sx2 < x6 + 41 AND sy2 > y6 - 11 AND sy2 < y6 + 21 AND e3 = 0 AND boss = 0 THEN
  454.         ENEMYEXPLOSION3 sx2, sy2, x6, y6, sx4, sy4
  455.         FOR sz = .25 TO 5 STEP .25
  456.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  457.         NEXT sz
  458.         GOSUB redrawshooter:
  459.         points = points + 100
  460.         e3 = 1
  461.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  462.             level = level + 1
  463.             level2 = level2 + 1
  464.             e1 = 0: E2 = 0: e3 = 0
  465.         END IF
  466.         lives$ = STR$(lives)
  467.         points$ = STR$(points)
  468.         level$ = STR$(level2)
  469.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  470.         ushoot = 0
  471.         GOTO go:
  472.     END IF
  473.  
  474.     'To see if you hit the Boss.
  475.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 1 THEN
  476.         B = B + 1
  477.         BB = 10 - B
  478.         LOCATE 3, 3: PRINT "BOSS ROBOT:"
  479.         IF bx = 0 THEN GOTO bxx:
  480.         LINE (150, 30)-(bx + 150, 50), _RGB32(0, 0, 0), BF
  481.         bxx:
  482.         bx = BB * 10
  483.         IF bx < 0 THEN GOTO bxx2:
  484.         LINE (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF
  485.         bxx2:
  486.         SOUND 100, 1
  487.         points = points + 100
  488.         lives$ = STR$(lives)
  489.         points$ = STR$(points)
  490.         level$ = STR$(level2)
  491.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  492.         FOR sz = .25 TO 5 STEP .25
  493.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  494.         NEXT sz
  495.         IF B > 10 THEN ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  496.         IF B < 11 THEN ushoot = 0: RETURN
  497.         LINE (0, 0)-(800, 200), _RGB32(0, 0, 0), BF
  498.         GOSUB redrawshooter:
  499.         bx = 0
  500.         BB = 0
  501.         B = 0
  502.         boss = 0
  503.         points = points + 1000
  504.         level = level + 1
  505.         level2 = level2 + 1
  506.         e1 = 0: E2 = 0: e3 = 0
  507.         lives$ = STR$(lives)
  508.         points$ = STR$(points)
  509.         level$ = STR$(level2)
  510.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  511.         ushoot = 0
  512.         GOTO go:
  513.     END IF
  514.  
  515. redrawshooter:
  516. FOR sz = .25 TO 10 STEP .25
  517.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  518. NEXT sz
  519. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  520.  
  521. 'The enemy's shot and if it reaches you.
  522. shoot:
  523. _LIMIT 1000
  524. IF shooting = 0 AND e1 = 0 THEN
  525.     GOSUB checktoshoot:
  526.     sh = INT(RND * 10000) + 1
  527.     IF sh < shh THEN GOTO nexone:
  528.     'sx and sy are the first enemy shot coordinates.
  529.     sx = x2 + 10
  530.     sy = y2 + 10
  531.     shooting = 1
  532.     SOUND 300, .5
  533. nexone:
  534. IF shooting2 = 0 AND E2 = 0 THEN
  535.     GOSUB checktoshoot:
  536.     sh2 = INT(RND * 10000) + 1
  537.     IF sh2 < shh THEN GOTO nexone2:
  538.  
  539.     'sx3 and sy3 are the second enemy shot coordinates.
  540.     sx3 = x5 + 10
  541.     sy3 = y5 + 10
  542.     shooting2 = 1
  543.     SOUND 300, .5
  544. nexone2:
  545. IF shooting3 = 0 AND e3 = 0 THEN
  546.     GOSUB checktoshoot:
  547.     sh3 = INT(RND * 10000) + 1
  548.     IF sh3 < shh THEN GOTO nexone3:
  549.  
  550.     'sx4 and sy4 are the third enemy shot coordinates.
  551.     sx4 = x6 + 10
  552.     sy4 = y6 + 10
  553.     shooting3 = 1
  554.     SOUND 300, .5
  555.  
  556. nexone3:
  557. 'To see if first enemy hit you.
  558. IF shooting = 1 AND e1 = 0 THEN
  559.     FOR sz2 = .25 TO 5 STEP .25
  560.         CIRCLE (sx, sy), sz2, _RGB32(0, 0, 0)
  561.     NEXT sz2
  562.     sy = sy + 3
  563.     IF sy > 620 THEN shooting = 0: GOTO nex4:
  564.     FOR szz2 = .25 TO 5 STEP .25
  565.         CIRCLE (sx, sy), szz2, _RGB32(255, 0, 0)
  566.     NEXT szz2
  567.     IF sx > xt - 1 AND sx < xt + 21 AND sy > yt - 1 AND sy < yt + 21 THEN
  568.         FOR sz3 = .25 TO 5 STEP .25
  569.             CIRCLE (sx, sy), sz3, _RGB32(0, 0, 0)
  570.         NEXT sz3
  571.         shooting = 0
  572.         GOSUB explosion:
  573.     END IF
  574. nex4:
  575.  
  576. 'To see if second enemy hit you.
  577. IF shooting2 = 1 AND E2 = 0 THEN
  578.     FOR sz2 = .25 TO 5 STEP .25
  579.         CIRCLE (sx3, sy3), sz2, _RGB32(0, 0, 0)
  580.     NEXT sz2
  581.     sy3 = sy3 + 3
  582.     IF sy3 > 620 THEN shooting2 = 0: GOTO nexx:
  583.     FOR szz2 = .25 TO 5 STEP .25
  584.         CIRCLE (sx3, sy3), szz2, _RGB32(255, 0, 0)
  585.     NEXT szz2
  586.     IF sx3 > xt - 1 AND sx3 < xt + 21 AND sy3 > yt - 1 AND sy3 < yt + 21 THEN
  587.         FOR sz3 = .25 TO 5 STEP .25
  588.             CIRCLE (sx3, sy3), sz3, _RGB32(0, 0, 0)
  589.         NEXT sz3
  590.         shooting2 = 0
  591.         GOSUB explosion:
  592.     END IF
  593.  
  594. nexx:
  595. 'To see if third enemy hit you.
  596. IF shooting3 = 1 AND e3 = 0 THEN
  597.     FOR sz2 = .25 TO 5 STEP .25
  598.         CIRCLE (sx4, sy4), sz2, _RGB32(0, 0, 0)
  599.     NEXT sz2
  600.     sy4 = sy4 + 3
  601.     IF sy4 > 620 THEN shooting3 = 0: RETURN
  602.     FOR szz2 = .25 TO 5 STEP .25
  603.         CIRCLE (sx4, sy4), szz2, _RGB32(255, 0, 0)
  604.     NEXT szz2
  605.     IF sx4 > xt - 1 AND sx4 < xt + 21 AND sy4 > yt - 1 AND sy4 < yt + 21 THEN
  606.         FOR sz3 = .25 TO 5 STEP .25
  607.             CIRCLE (sx4, sy4), sz3, _RGB32(0, 0, 0)
  608.         NEXT sz3
  609.         shooting3 = 0
  610.         GOSUB explosion:
  611.     END IF
  612.  
  613. explosion:
  614. FOR sz = .25 TO 10 STEP .25
  615.     CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  616. NEXT sz
  617. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  618. SOUND 400, .5
  619. SOUND 300, .5
  620. SOUND 200, .5
  621. SOUND 100, .5
  622. dxx = (RND * 6) + -3
  623. dyy = (RND * 6) + -3
  624. dxx2 = (RND * 6) + -3
  625. dyy2 = (RND * 6) + -3
  626. dxx3 = (RND * 6) + -3
  627. dyy3 = (RND * 6) + -3
  628. dxx4 = (RND * 6) + -3
  629. dyy4 = (RND * 6) + -3
  630. dxx5 = (RND * 6) + -3
  631. dyy5 = (RND * 6) + -3
  632. dxx6 = (RND * 6) + -3
  633. dyy6 = (RND * 6) + -3
  634. yourexplosion:
  635. DD = DD + 1
  636. dxx = dxx + dxx / 4
  637. dxx2 = dxx2 + dxx2 / 4
  638. dxx3 = dxx3 + dxx3 / 4
  639. dxx4 = dxx4 + dxx4 / 4
  640. dxx5 = dxx5 + dxx5 / 4
  641. dxx6 = dxx6 + dxx6 / 4
  642. dyy = dyy + dyy / 4
  643. dyy2 = dyy2 + dyy2 / 4
  644. dyy3 = dyy3 + dyy3 / 4
  645. dyy4 = dyy4 + dyy4 / 4
  646. dyy5 = dyy5 + dyy5 / 4
  647. dyy6 = dyy6 + dyy6 / 4
  648. LINE (xt + dxx, yt + dyy)-(xt + dxx + 2, yt + dyy + 2), _RGB32(255, 0, 0), BF
  649. LINE (xt + dxx2, yt + dyy2)-(xt + dxx2 + 2, yt + dyy2 + 2), _RGB32(0, 255, 0), BF
  650. LINE (xt + dxx3, yt + dyy3)-(xt + dxx3 + 2, yt + dyy3 + 2), _RGB32(255, 0, 0), BF
  651. LINE (xt + dxx4, yt + dyy4)-(xt + dxx4 + 2, yt + dyy4 + 2), _RGB32(0, 255, 0), BF
  652. LINE (xt + dxx5, yt + dyy5)-(xt + dxx5 + 2, yt + dyy5 + 2), _RGB32(255, 0, 0), BF
  653. LINE (xt + dxx6, yt + dyy6)-(xt + dxx6 + 2, yt + dyy6 + 2), _RGB32(0, 255, 0), BF
  654. _DELAY .02
  655. LINE (xt + dxx, yt + dyy)-(xt + dxx + 2, yt + dyy + 2), _RGB32(0, 0, 0), BF
  656. LINE (xt + dxx2, yt + dyy2)-(xt + dxx2 + 2, yt + dyy2 + 2), _RGB32(0, 0, 0), BF
  657. LINE (xt + dxx3, yt + dyy3)-(xt + dxx3 + 2, yt + dyy3 + 2), _RGB32(0, 0, 0), BF
  658. LINE (xt + dxx4, yt + dyy4)-(xt + dxx4 + 2, yt + dyy4 + 2), _RGB32(0, 0, 0), BF
  659. LINE (xt + dxx5, yt + dyy5)-(xt + dxx5 + 2, yt + dyy5 + 2), _RGB32(0, 0, 0), BF
  660. LINE (xt + dxx6, yt + dyy6)-(xt + dxx6 + 2, yt + dyy6 + 2), _RGB32(0, 0, 0), BF
  661. IF DD > 20 THEN GOTO back2:
  662. GOTO yourexplosion:
  663. back2:
  664. DD = 0
  665. lives = lives - 1
  666. lives$ = STR$(lives)
  667. points$ = STR$(points)
  668. level$ = STR$(level2)
  669. _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  670. LINE (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF
  671. IF lives = 0 THEN
  672.     LOCATE 20, 40: PRINT "G A M E   O V E R"
  673.     LOCATE 22, 40: PRINT "Score: "; points
  674.     LOCATE 23, 40: PRINT "Level: "; level2
  675.     LOCATE 25, 40: INPUT "Press Enter to go to Top Ten Scores.", tt$
  676.  
  677.     'Top Ten Scores
  678.     scc = points
  679.     IF _FILEEXISTS("toptentech.txt") THEN
  680.     ELSE
  681.         OPEN "toptentech.txt" FOR OUTPUT AS #1
  682.         RESTORE originaltopten
  683.         DO
  684.             READ toptenname$, toptenscore!
  685.             IF toptenname$ = "EOF" THEN EXIT DO
  686.             PRINT #1, toptenname$
  687.             PRINT #1, toptenscore!
  688.         LOOP
  689.         CLOSE #1
  690.     END IF
  691.  
  692.     OPEN "toptentech.txt" FOR INPUT AS #1
  693.     FOR n = 1 TO 10
  694.         INPUT #1, name$(n)
  695.         INPUT #1, score(n)
  696.         IF scc > score(n) AND sct = 0 THEN
  697.             NN = n
  698.             PRINT "You have made the Top Ten!"
  699.             typename:
  700.             INPUT "Type your name here (25 letters and spaces maximum.):", nm$(NN)
  701.             IF LEN(nm$(NN)) > 25 THEN
  702.                 PRINT "Name too long, try again."
  703.                 GOTO typename:
  704.             END IF
  705.             sccc(NN) = scc
  706.             sct = 1
  707.         END IF
  708.         IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  709.     NEXT n
  710.     CLOSE #1
  711.     nex5:
  712.     CLOSE #1
  713.     OPEN "toptentech.txt" FOR OUTPUT AS #1
  714.     FOR n = 1 TO NN
  715.         IF n <> NN THEN PRINT #1, name$(n): PRINT #1, score(n)
  716.         IF n = NN THEN
  717.             PRINT #1, nm$(n)
  718.             PRINT #1, sccc(n)
  719.         END IF
  720.     NEXT n
  721.     nex6:
  722.     FOR n = NN TO 10
  723.         PRINT #1, name$(n): PRINT #1, score(n)
  724.     NEXT n
  725.     CLOSE #1
  726.     nex7:
  727.     CLS
  728.     PRINT: PRINT: PRINT
  729.     PRINT "                                         T O P    T E N "
  730.     PRINT: PRINT: PRINT
  731.     OPEN "toptentech.txt" FOR INPUT AS #1
  732.     FOR n = 1 TO 10
  733.         IF EOF(1) THEN GOTO nex8:
  734.         INPUT #1, name$(n)
  735.         INPUT #1, score(n)
  736.         PRINT "             "; n; ". "; name$(n); score(n)
  737.     NEXT n
  738.     nex8:
  739.     CLOSE #1
  740.     FOR n = 1 TO 10
  741.         nm$(n) = ""
  742.         score(n) = 0
  743.         name$(n) = ""
  744.         sccc(n) = 0
  745.     NEXT n
  746.     NN = 0
  747.     n = 0
  748.     sct = 0
  749.     scc = 0
  750.     LOCATE 23, 1
  751.     INPUT "Would you like to play again? (Yes/No)", ag$
  752.     IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" OR ag$ = "YEs" THEN GOTO begin:
  753.     END
  754. OPENINGSOUND
  755.  
  756. checktoshoot:
  757. IF level2 = 1 THEN shh = 9950
  758. IF level2 = 2 THEN shh = 9945
  759. IF level2 = 3 THEN shh = 9940
  760. IF level2 = 4 THEN shh = 9935
  761. IF level2 = 5 THEN shh = 9930
  762. IF level2 = 6 THEN shh = 9925
  763. IF level2 > 6 THEN shh = 9920
  764.  
  765. originaltopten:
  766. DATA Space Ace,7000
  767. DATA Suzy Swift,6000
  768. DATA Speedy Spencer,5000
  769. DATA Super Sam,4000
  770. DATA Battery Bob,3000
  771. DATA Karen Kryptonite,2750
  772. DATA Quick Ken,2500
  773. DATA Tiger Tessa,2250
  774. DATA Arcade Joe,2000
  775. DATA How Do U Play,1750
  776.  
  777. SUB OPENINGSOUND
  778.     snd = 300
  779.     snd2 = 800
  780.     FOR t = 1 TO 50
  781.         IF snd > 800 THEN snd = 300
  782.         IF snd2 < 300 THEN snd2 = 800
  783.         snd = snd + 10
  784.         SOUND snd, .25
  785.     NEXT t
  786.  
  787. SUB ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy)
  788.     FOR sz4 = .25 TO 5 STEP .25
  789.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  790.     NEXT sz4
  791.     SOUND 400, .5
  792.     SOUND 300, .5
  793.     SOUND 200, .5
  794.     SOUND 100, .5
  795.     dxx = (RND * 6) + -3
  796.     dyy = (RND * 6) + -3
  797.     dxx2 = (RND * 6) + -3
  798.     dyy2 = (RND * 6) + -3
  799.     dxx3 = (RND * 6) + -3
  800.     dyy3 = (RND * 6) + -3
  801.     dxx4 = (RND * 6) + -3
  802.     dyy4 = (RND * 6) + -3
  803.     dxx5 = (RND * 6) + -3
  804.     dyy5 = (RND * 6) + -3
  805.     dxx6 = (RND * 6) + -3
  806.     dyy6 = (RND * 6) + -3
  807.     explosion1:
  808.     dd = dd + 1
  809.     dxx = dxx + dxx / 4
  810.     dxx2 = dxx2 + dxx2 / 4
  811.     dxx3 = dxx3 + dxx3 / 4
  812.     dxx4 = dxx4 + dxx4 / 4
  813.     dxx5 = dxx5 + dxx5 / 4
  814.     dxx6 = dxx6 + dxx6 / 4
  815.     dyy = dyy + dyy / 4
  816.     dyy2 = dyy2 + dyy2 / 4
  817.     dyy3 = dyy3 + dyy3 / 4
  818.     dyy4 = dyy4 + dyy4 / 4
  819.     dyy5 = dyy5 + dyy5 / 4
  820.     dyy6 = dyy6 + dyy6 / 4
  821.     LINE (x2 + dxx, y2 + dyy)-(x2 + dxx + 2, y2 + dyy + 2), _RGB32(255, 0, 0), BF
  822.     LINE (x2 + dxx2, y2 + dyy2)-(x2 + dxx2 + 2, y2 + dyy2 + 2), _RGB32(0, 255, 0), BF
  823.     LINE (x2 + dxx3, y2 + dyy3)-(x2 + dxx3 + 2, y2 + dyy3 + 2), _RGB32(255, 0, 0), BF
  824.     LINE (x2 + dxx4, y2 + dyy4)-(x2 + dxx4 + 2, y2 + dyy4 + 2), _RGB32(0, 255, 0), BF
  825.     LINE (x2 + dxx5, y2 + dyy5)-(x2 + dxx5 + 2, y2 + dyy5 + 2), _RGB32(255, 0, 0), BF
  826.     LINE (x2 + dxx6, y2 + dyy6)-(x2 + dxx6 + 2, y2 + dyy6 + 2), _RGB32(0, 255, 0), BF
  827.     _DELAY .02
  828.     LINE (x2 + dxx, y2 + dyy)-(x2 + dxx + 2, y2 + dyy + 2), _RGB32(0, 0, 0), BF
  829.     LINE (x2 + dxx2, y2 + dyy2)-(x2 + dxx2 + 2, y2 + dyy2 + 2), _RGB32(0, 0, 0), BF
  830.     LINE (x2 + dxx3, y2 + dyy3)-(x2 + dxx3 + 2, y2 + dyy3 + 2), _RGB32(0, 0, 0), BF
  831.     LINE (x2 + dxx4, y2 + dyy4)-(x2 + dxx4 + 2, y2 + dyy4 + 2), _RGB32(0, 0, 0), BF
  832.     LINE (x2 + dxx5, y2 + dyy5)-(x2 + dxx5 + 2, y2 + dyy5 + 2), _RGB32(0, 0, 0), BF
  833.     LINE (x2 + dxx6, y2 + dyy6)-(x2 + dxx6 + 2, y2 + dyy6 + 2), _RGB32(0, 0, 0), BF
  834.     IF dd > 20 THEN GOTO goingback
  835.     GOTO explosion1:
  836.     goingback:
  837.     dd = 0
  838.     LINE (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF
  839.     FOR sz4 = .25 TO 5 STEP .25
  840.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  841.     NEXT sz4
  842.     FOR sz4 = .25 TO 5 STEP .25
  843.         CIRCLE (sx, sy), sz4, _RGB32(0, 0, 0)
  844.     NEXT sz4
  845.  
  846. SUB ENEMYEXPLOSION2 (sx2, sy2, x5, y5, sx3, sy3)
  847.     FOR sz5 = .25 TO 5 STEP .25
  848.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  849.     NEXT sz5
  850.     SOUND 400, .5
  851.     SOUND 300, .5
  852.     SOUND 200, .5
  853.     SOUND 100, .5
  854.     dxx = (RND * 6) + -3
  855.     dyy = (RND * 6) + -3
  856.     dxx2 = (RND * 6) + -3
  857.     dyy2 = (RND * 6) + -3
  858.     dxx3 = (RND * 6) + -3
  859.     dyy3 = (RND * 6) + -3
  860.     dxx4 = (RND * 6) + -3
  861.     dyy4 = (RND * 6) + -3
  862.     dxx5 = (RND * 6) + -3
  863.     dyy5 = (RND * 6) + -3
  864.     dxx6 = (RND * 6) + -3
  865.     dyy6 = (RND * 6) + -3
  866.     explosion2:
  867.     dd = dd + 1
  868.     dxx = dxx + dxx / 4
  869.     dxx2 = dxx2 + dxx2 / 4
  870.     dxx3 = dxx3 + dxx3 / 4
  871.     dxx4 = dxx4 + dxx4 / 4
  872.     dxx5 = dxx5 + dxx5 / 4
  873.     dxx6 = dxx6 + dxx6 / 4
  874.     dyy = dyy + dyy / 4
  875.     dyy2 = dyy2 + dyy2 / 4
  876.     dyy3 = dyy3 + dyy3 / 4
  877.     dyy4 = dyy4 + dyy4 / 4
  878.     dyy5 = dyy5 + dyy5 / 4
  879.     dyy6 = dyy6 + dyy6 / 4
  880.     LINE (x5 + dxx, y5 + dyy)-(x5 + dxx + 2, y5 + dyy + 2), _RGB32(255, 0, 0), BF
  881.     LINE (x5 + dxx2, y5 + dyy2)-(x5 + dxx2 + 2, y5 + dyy2 + 2), _RGB32(0, 255, 0), BF
  882.     LINE (x5 + dxx3, y5 + dyy3)-(x5 + dxx3 + 2, y5 + dyy3 + 2), _RGB32(255, 0, 0), BF
  883.     LINE (x5 + dxx4, y5 + dyy4)-(x5 + dxx4 + 2, y5 + dyy4 + 2), _RGB32(0, 255, 0), BF
  884.     LINE (x5 + dxx5, y5 + dyy5)-(x5 + dxx5 + 2, y5 + dyy5 + 2), _RGB32(255, 0, 0), BF
  885.     LINE (x5 + dxx6, y5 + dyy6)-(x5 + dxx6 + 2, y5 + dyy6 + 2), _RGB32(0, 255, 0), BF
  886.     _DELAY .02
  887.     LINE (x5 + dxx, y5 + dyy)-(x5 + dxx + 2, y5 + dyy + 2), _RGB32(0, 0, 0), BF
  888.     LINE (x5 + dxx2, y5 + dyy2)-(x5 + dxx2 + 2, y5 + dyy2 + 2), _RGB32(0, 0, 0), BF
  889.     LINE (x5 + dxx3, y5 + dyy3)-(x5 + dxx3 + 2, y5 + dyy3 + 2), _RGB32(0, 0, 0), BF
  890.     LINE (x5 + dxx4, y5 + dyy4)-(x5 + dxx4 + 2, y5 + dyy4 + 2), _RGB32(0, 0, 0), BF
  891.     LINE (x5 + dxx5, y5 + dyy5)-(x5 + dxx5 + 2, y5 + dyy5 + 2), _RGB32(0, 0, 0), BF
  892.     LINE (x5 + dxx6, y5 + dyy6)-(x5 + dxx6 + 2, y5 + dyy6 + 2), _RGB32(0, 0, 0), BF
  893.     IF dd > 20 THEN GOTO goingback2:
  894.     GOTO explosion2:
  895.     goingback2:
  896.     dd = 0
  897.     LINE (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF
  898.     FOR sz5 = .25 TO 5 STEP .25
  899.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  900.     NEXT sz5
  901.     FOR sz5 = .25 TO 5 STEP .25
  902.         CIRCLE (sx3, sy3), sz5, _RGB32(0, 0, 0)
  903.     NEXT sz5
  904.  
  905. SUB ENEMYEXPLOSION3 (sx2, sy2, x6, y6, sx4, sy4)
  906.     FOR sz6 = .25 TO 5 STEP .25
  907.         CIRCLE (sx2, sy2), sz6, _RGB32(0, 0, 0)
  908.     NEXT sz6
  909.     SOUND 400, .5
  910.     SOUND 300, .5
  911.     SOUND 200, .5
  912.     SOUND 100, .5
  913.     dxx = (RND * 6) + -3
  914.     dyy = (RND * 6) + -3
  915.     dxx2 = (RND * 6) + -3
  916.     dyy2 = (RND * 6) + -3
  917.     dxx3 = (RND * 6) + -3
  918.     dyy3 = (RND * 6) + -3
  919.     dxx4 = (RND * 6) + -3
  920.     dyy4 = (RND * 6) + -3
  921.     dxx5 = (RND * 6) + -3
  922.     dyy5 = (RND * 6) + -3
  923.     dxx6 = (RND * 6) + -3
  924.     dyy6 = (RND * 6) + -3
  925.     explosion3:
  926.     dd = dd + 1
  927.     dxx = dxx + dxx / 4
  928.     dxx2 = dxx2 + dxx2 / 4
  929.     dxx3 = dxx3 + dxx3 / 4
  930.     dxx4 = dxx4 + dxx4 / 4
  931.     dxx5 = dxx5 + dxx5 / 4
  932.     dxx6 = dxx6 + dxx6 / 4
  933.     dyy = dyy + dyy / 4
  934.     dyy2 = dyy2 + dyy2 / 4
  935.     dyy3 = dyy3 + dyy3 / 4
  936.     dyy4 = dyy4 + dyy4 / 4
  937.     dyy5 = dyy5 + dyy5 / 4
  938.     dyy6 = dyy6 + dyy6 / 4
  939.     LINE (x6 + dxx, y6 + dyy)-(x6 + dxx + 2, y6 + dyy + 2), _RGB32(255, 0, 0), BF
  940.     LINE (x6 + dxx2, y6 + dyy2)-(x6 + dxx2 + 2, y6 + dyy2 + 2), _RGB32(0, 255, 0), BF
  941.     LINE (x6 + dxx3, y6 + dyy3)-(x6 + dxx3 + 2, y6 + dyy3 + 2), _RGB32(255, 0, 0), BF
  942.     LINE (x6 + dxx4, y6 + dyy4)-(x6 + dxx4 + 2, y6 + dyy4 + 2), _RGB32(0, 255, 0), BF
  943.     LINE (x6 + dxx5, y6 + dyy5)-(x6 + dxx5 + 2, y6 + dyy5 + 2), _RGB32(255, 0, 0), BF
  944.     LINE (x6 + dxx6, y6 + dyy6)-(x6 + dxx6 + 2, y6 + dyy6 + 2), _RGB32(0, 255, 0), BF
  945.     _DELAY .02
  946.     LINE (x6 + dxx, y6 + dyy)-(x6 + dxx + 2, y6 + dyy + 2), _RGB32(0, 0, 0), BF
  947.     LINE (x6 + dxx2, y6 + dyy2)-(x6 + dxx2 + 2, y6 + dyy2 + 2), _RGB32(0, 0, 0), BF
  948.     LINE (x6 + dxx3, y6 + dyy3)-(x6 + dxx3 + 2, y6 + dyy3 + 2), _RGB32(0, 0, 0), BF
  949.     LINE (x6 + dxx4, y6 + dyy4)-(x6 + dxx4 + 2, y6 + dyy4 + 2), _RGB32(0, 0, 0), BF
  950.     LINE (x6 + dxx5, y6 + dyy5)-(x6 + dxx5 + 2, y6 + dyy5 + 2), _RGB32(0, 0, 0), BF
  951.     LINE (x6 + dxx6, y6 + dyy6)-(x6 + dxx6 + 2, y6 + dyy6 + 2), _RGB32(0, 0, 0), BF
  952.     IF dd > 20 THEN GOTO goingback3:
  953.     GOTO explosion3:
  954.     goingback3:
  955.     dd = 0
  956.     LINE (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF
  957.     FOR sz5 = .25 TO 5 STEP .25
  958.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  959.     NEXT sz5
  960.     FOR sz5 = .25 TO 5 STEP .25
  961.         CIRCLE (sx4, sy4), sz5, _RGB32(0, 0, 0)
  962.     NEXT sz5
  963.  
« Last Edit: July 27, 2019, 11:01:43 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #12 on: July 27, 2019, 10:21:50 pm »
Here's a video with it having exploding particles. :)




Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tech Invaders 2
« Reply #13 on: July 27, 2019, 10:55:49 pm »
Dude, you suck at that game. Better go back to racing cars!

OK, I did see the top ten list. I think there is something to keeping demos short. Speaking of which, you might want to nclude a key that skips the intro, or maybe the play again does that?

Anyway, I posted your youtube vid over at The QBasic Forum. Nice job, and wow, you must have my old eyesight. What is the resolution on that IDE? Font size 4, maybe?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Tech Invaders 2
« Reply #14 on: July 27, 2019, 10:59:34 pm »
Pete, I just use full-screen to code in on a big monitor, no changes in font. Thanks for putting it on the QBasic forum! I appreciate it. LOL yeah I didn't play good in that video on purpose because I didn't want people thinking was better than they could be. Although I did forget to erase the Top Score sheet, oh well, maybe they can beat me. :) Oh and for the welcome screen, I kind of like it myself, it gives yourself a short break, since the game has no Pause feature. :)

Here is the fix again. lol Sorry about that. It needed to redraw the shooter after the new excplosion.
HERE is the final version:

Code: QB64: [Select]
  1. 'Tech Invaders 2
  2. 'Game made on July 27, 2019
  3. 'By Ken G.
  4. 'Freeware
  5. '---------------------------------------------------------------------------------------------------------------------------------------
  6. 'Directions:
  7. 'Move your shooter with the left and right arrow keys and press the space bar to fire at the enemies above.
  8. 'The up and down arrow keys make your shooter stop moving.
  9. 'Esc key ends at anytime.
  10. 'After a couple of rounds, there is the Boss to destroy, which has a health bar that shrinks when you hit him.
  11. '---------------------------------------------------------------------------------------------------------------------------------------
  12. 'I have put some descriptions in the code below to make it easier to learn from.
  13. '
  14. begin:
  15. DIM name$(50), nm$(50), score(50), sccc(50)
  16. _TITLE "Tech Invaders 2"
  17. SCREEN _NEWIMAGE(800, 600, 32)
  18. FOR tt = 79 TO 34 STEP -1
  19.     LOCATE 3, tt + 1: PRINT " "
  20.     LOCATE 3, tt: PRINT "T"
  21.     _DELAY .03
  22. NEXT tt
  23. FOR ee = 79 TO 36 STEP -1
  24.     LOCATE 3, ee + 1: PRINT " "
  25.     LOCATE 3, ee: PRINT "E"
  26.     _DELAY .03
  27. NEXT ee
  28. FOR cc = 79 TO 38 STEP -1
  29.     LOCATE 3, cc + 1: PRINT " "
  30.     LOCATE 3, cc: PRINT "C"
  31.     _DELAY .03
  32. NEXT cc
  33. FOR hh = 79 TO 40 STEP -1
  34.     LOCATE 3, hh + 1: PRINT " "
  35.     LOCATE 3, hh: PRINT "H"
  36.     _DELAY .03
  37. NEXT hh
  38. FOR II = 79 TO 47 STEP -1
  39.     LOCATE 3, II + 1: PRINT " "
  40.     LOCATE 3, II: PRINT "I"
  41.     _DELAY .03
  42. NEXT II
  43. FOR NN = 79 TO 49 STEP -1
  44.     LOCATE 3, NN + 1: PRINT " "
  45.     LOCATE 3, NN: PRINT "N"
  46.     _DELAY .03
  47. NEXT NN
  48. FOR VV = 79 TO 51 STEP -1
  49.     LOCATE 3, VV + 1: PRINT " "
  50.     LOCATE 3, VV: PRINT "V"
  51.     _DELAY .03
  52. NEXT VV
  53. FOR AA = 79 TO 53 STEP -1
  54.     LOCATE 3, AA + 1: PRINT " "
  55.     LOCATE 3, AA: PRINT "A"
  56.     _DELAY .03
  57. NEXT AA
  58. FOR DD = 79 TO 55 STEP -1
  59.     LOCATE 3, DD + 1: PRINT " "
  60.     LOCATE 3, DD: PRINT "D"
  61.     _DELAY .03
  62. NEXT DD
  63. FOR EE2 = 79 TO 57 STEP -1
  64.     LOCATE 3, EE2 + 1: PRINT " "
  65.     LOCATE 3, EE2: PRINT "E"
  66.     _DELAY .03
  67. NEXT EE2
  68. FOR RR = 79 TO 59 STEP -1
  69.     LOCATE 3, RR + 1: PRINT " "
  70.     LOCATE 3, RR: PRINT "R"
  71.     _DELAY .03
  72. NEXT RR
  73. FOR ss = 79 TO 61 STEP -1
  74.     LOCATE 3, ss + 1: PRINT " "
  75.     LOCATE 3, ss: PRINT "S"
  76.     _DELAY .03
  77. NEXT ss
  78. DD = 0
  79. PRINT "                                         T W O"
  80. PRINT "                                        by Ken G."
  81. PRINT "                       Use left and right arrow keys to move back and forth."
  82. PRINT "                            Use up or down arrow keys to stop moving."
  83. PRINT "                                    Use space bar to fire."
  84. PRINT "                                      Esc to end anytime."
  85. INPUT "                                   Press Enter to start.", start$
  86. e1 = 0
  87. E2 = 0
  88. e3 = 0
  89. lives = 5
  90. points = 0
  91. ushoot = 0
  92. shooting = 0
  93. level = 1
  94. level2 = 1
  95. start = 0
  96. s = 0
  97. xt = 400
  98. yt = 560
  99. B = 0
  100. boss = 0
  101.  
  102. 'Draw your shooter.
  103. FOR sz = .25 TO 10 STEP .25
  104.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  105. NEXT sz
  106. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  107.  
  108. OPENINGSOUND
  109.  
  110. 'This is the start of the main loop.
  111. go:
  112. 'Choose a random place for the enemy.
  113.  
  114. IF e1 = 0 AND E2 = 0 AND e3 = 0 THEN
  115.     xx = INT(RND * 200) + 100
  116.     yy = INT(RND * 100) + 40
  117.     xx2 = INT(RND * 200) + 200
  118.     yy2 = INT(RND * 100) + 40
  119.     xx3 = INT(RND * 200) + 250
  120.     yy3 = INT(RND * 100) + 40
  121.  
  122. 'Each level has its own loop so it can set a different equation and speed of the enemy.
  123.  
  124. IF level = 1 THEN
  125.     c1 = 128: c2 = 127: c3 = 255
  126.     one:
  127.     'sec is not time, it's related to the coordinate of the enemy and speed it goes related to the loop speed.
  128.     sec = sec + .02
  129.     s = (60 - sec) * 6 + 180
  130.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  131.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  132.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  133.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  134.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  135.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  136.  
  137.     'GOSUB to drawing draws the enemy robot.
  138.     IF e1 <> 1 THEN GOSUB drawing:
  139.     IF E2 <> 1 THEN GOSUB drawing3:
  140.     IF e3 <> 1 THEN GOSUB drawing4:
  141.     _DELAY .006
  142.     GOSUB erase:
  143.     IF sec > 180 THEN
  144.         sec = 0
  145.         GOTO onedone:
  146.     END IF
  147.  
  148.     'GOSUB's go to keyboard control and enemy shooting.
  149.     GOSUB keyboard:
  150.     GOSUB shoot:
  151.     GOSUB youshoot2:
  152.     GOTO one:
  153.     onedone:
  154.  
  155. 'This level uses the spiral equation so it's a bit different than the others.
  156. IF level = 2 THEN
  157.     c1 = 127: c2 = 216: c3 = 127
  158.     xx = 400: yy = 300
  159.     xx2 = 100: yy2 = 300
  160.     xx3 = 600: yy3 = 300
  161.     FOR D = 160 TO 0 STEP -.125
  162.         _LIMIT 1000
  163.         s = s + .2
  164.         x = COS(s * 3.141592 / 180) * D
  165.         y = SIN(s * 3.151492 / 180) * D
  166.         x3 = COS(s * 3.141592 / 180) * D
  167.         y3 = SIN(s * 3.151492 / 180) * D
  168.         x4 = COS(s * 3.141592 / 180) * D
  169.         y4 = SIN(s * 3.151492 / 180) * D
  170.         IF e1 <> 1 THEN GOSUB drawing:
  171.         IF E2 <> 1 THEN GOSUB drawing3:
  172.         IF e3 <> 1 THEN GOSUB drawing4:
  173.         _DELAY .006
  174.         GOSUB erase:
  175.         GOSUB keyboard:
  176.         GOSUB shoot:
  177.         GOSUB youshoot2:
  178.     NEXT D
  179.     FOR D = 0 TO 160 STEP .125
  180.         _LIMIT 1000
  181.         s = s - .2
  182.         x = COS(s * 3.141592 / 180) * D
  183.         y = SIN(s * 3.151492 / 180) * D
  184.         x3 = COS(s * 3.141592 / 180) * D
  185.         y3 = SIN(s * 3.151492 / 180) * D
  186.         x4 = COS(s * 3.141592 / 180) * D
  187.         y4 = SIN(s * 3.151492 / 180) * D
  188.         IF e1 <> 1 THEN GOSUB drawing:
  189.         IF E2 <> 1 THEN GOSUB drawing3:
  190.         IF e3 <> 1 THEN GOSUB drawing4:
  191.         _DELAY .006
  192.         GOSUB erase:
  193.         GOSUB keyboard:
  194.         GOSUB shoot:
  195.         GOSUB youshoot2:
  196.     NEXT D
  197.  
  198. IF level = 3 THEN
  199.     c1 = 255: c2 = 0: c3 = 0
  200.     three:
  201.     sec = sec + .02
  202.     s = (60 - sec) * 6 + 180
  203.     x = INT(SIN(s / 90 * 3.141592) * 180) + 325
  204.     y = INT(COS(s / 180 * 3.141592) * 180) + 225
  205.     x3 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  206.     y3 = INT(COS(s / 180 * 3.141592) * 180) + 225
  207.     x4 = INT(SIN(s / 90 * 3.141592) * 180) + 325
  208.     y4 = INT(COS(s / 180 * 3.141592) * 180) + 225
  209.     IF e1 <> 1 THEN GOSUB drawing:
  210.     IF E2 <> 1 THEN GOSUB drawing3:
  211.     IF e3 <> 1 THEN GOSUB drawing4:
  212.     _DELAY .006
  213.     GOSUB erase:
  214.     IF sec > 60 THEN
  215.         sec = 0
  216.         GOTO threedone:
  217.     END IF
  218.     GOSUB keyboard:
  219.     GOSUB shoot:
  220.     GOSUB youshoot2:
  221.     GOTO three:
  222.     threedone:
  223.  
  224. IF level = 4 THEN
  225.     c1 = 255: c2 = 255: c3 = 127
  226.     four:
  227.     sec = sec + .02
  228.     s = (60 - sec) * 6 + 180
  229.     x = INT(SIN(s / 180 * 3.141592) * 180) + 325
  230.     y = INT(COS(s / 90 * 3.141592) * 180) + 225
  231.     x3 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  232.     y3 = INT(COS(s / 90 * 3.141592) * 180) + 225
  233.     x4 = INT(SIN(s / 180 * 3.141592) * 180) + 325
  234.     y4 = INT(COS(s / 90 * 3.141592) * 180) + 225
  235.     IF e1 <> 1 THEN GOSUB drawing:
  236.     IF E2 <> 1 THEN GOSUB drawing3:
  237.     IF e3 <> 1 THEN GOSUB drawing4:
  238.     _DELAY .006
  239.     GOSUB erase:
  240.     IF sec > 60 THEN
  241.         sec = 0
  242.         GOTO fourdone:
  243.     END IF
  244.     GOSUB keyboard:
  245.     GOSUB shoot:
  246.     GOSUB youshoot2:
  247.     GOTO four:
  248.     fourdone:
  249. IF level = 5 THEN
  250.     c1 = 133: c2 = 28: c3 = 255
  251.     five:
  252.     sec = sec + .02
  253.     s = (60 - sec) * 6 + 180
  254.     x = INT(SIN(s / 135 * 3.141592) * 180) + 325
  255.     y = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  256.     x3 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  257.     y3 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  258.     x4 = INT(SIN(s / 135 * 3.141592) * 180) + 325
  259.     y4 = INT(COS(s / 33.75 * 3.141592) * 180) + 225
  260.     IF e1 <> 1 THEN GOSUB drawing:
  261.     IF E2 <> 1 THEN GOSUB drawing3:
  262.     IF e3 <> 1 THEN GOSUB drawing4:
  263.     _DELAY .006
  264.     GOSUB erase:
  265.     IF sec > 60 THEN
  266.         sec = 0
  267.         GOTO fivedone:
  268.     END IF
  269.     GOSUB keyboard:
  270.     GOSUB shoot:
  271.     GOSUB youshoot2:
  272.     GOTO five:
  273.     fivedone:
  274.  
  275. IF level = 6 THEN
  276.     e1 = 0: E2 = 1: e3 = 1
  277.     boss = 1
  278.     c1 = 255: c2 = 0: c3 = 0
  279.     six:
  280.     sec = sec + .02
  281.     s = (60 - sec) * 6 + 180
  282.     x = INT(SIN(s / 45 * 3.141592) * 180) + 325
  283.     y = INT(COS(s / 360 * 3.141592) * 180) + 225
  284.     GOSUB drawing2:
  285.     IF sec > 120 THEN
  286.         sec = 0
  287.         GOTO sixdone:
  288.     END IF
  289.     GOSUB keyboard:
  290.     GOSUB shoot:
  291.     GOSUB youshoot2:
  292.     GOTO six:
  293.     sixdone:
  294. IF level = 7 THEN level = 1
  295. GOTO go:
  296. 'GOTO goes back to the start of the main loop.
  297.  
  298. 'Draws the enemy tank and erases it for animation.
  299. drawing:
  300. x2 = x + xx: y2 = y + yy
  301.  
  302. FOR t = 15 TO 20 STEP .25
  303.     CIRCLE (x2, y2), t, _RGB32(0, 255, 255)
  304. FOR t = .25 TO 15 STEP .25
  305.     CIRCLE (x2, y2), t, _RGB32(c1, c2, c3)
  306. FOR t = .25 TO 3 STEP .25
  307.     CIRCLE (x2 - 10, y2 - 5), t, _RGB32(0, 255, 255)
  308.     CIRCLE (x2 + 10, y2 - 5), t, _RGB32(0, 255, 255)
  309.     CIRCLE (x2, y2 + 10), t, _RGB32(0, 255, 255)
  310.  
  311. drawing3:
  312. x5 = x3 + xx2: y5 = y3 + yy2
  313.  
  314. FOR t = 15 TO 20 STEP .25
  315.     CIRCLE (x5, y5), t, _RGB32(0, 255, 255)
  316. FOR t = .25 TO 15 STEP .25
  317.     CIRCLE (x5, y5), t, _RGB32(c1, c2, c3)
  318. FOR t = .25 TO 3 STEP .25
  319.     CIRCLE (x5 - 10, y5 - 5), t, _RGB32(0, 255, 255)
  320.     CIRCLE (x5 + 10, y5 - 5), t, _RGB32(0, 255, 255)
  321.     CIRCLE (x5, y5 + 10), t, _RGB32(0, 255, 255)
  322.  
  323. drawing4:
  324. x6 = x4 + xx3: y6 = y4 + yy3
  325.  
  326. FOR t = 15 TO 20 STEP .25
  327.     CIRCLE (x6, y6), t, _RGB32(0, 255, 255)
  328. FOR t = .25 TO 15 STEP .25
  329.     CIRCLE (x6, y6), t, _RGB32(c1, c2, c3)
  330. FOR t = .25 TO 3 STEP .25
  331.     CIRCLE (x6 - 10, y6 - 5), t, _RGB32(0, 255, 255)
  332.     CIRCLE (x6 + 10, y6 - 5), t, _RGB32(0, 255, 255)
  333.     CIRCLE (x6, y6 + 10), t, _RGB32(0, 255, 255)
  334.  
  335. IF e1 = 0 THEN
  336.     FOR t = .25 TO 20 STEP .25
  337.         CIRCLE (x2, y2), t, _RGB32(0, 0, 0)
  338.     NEXT t
  339. IF E2 = 0 THEN
  340.     FOR t = .25 TO 20 STEP .25
  341.         CIRCLE (x5, y5), t, _RGB32(0, 0, 0)
  342.     NEXT t
  343. IF e3 = 0 THEN
  344.     FOR t = .25 TO 20 STEP .25
  345.         CIRCLE (x6, y6), t, _RGB32(0, 0, 0)
  346.     NEXT t
  347.  
  348. 'Draws the Boss Robot.
  349. drawing2:
  350. x2 = x + xx: y2 = y + yy
  351. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 255, 0), BF
  352. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 255, 0), BF
  353. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 255, 0), BF
  354. FOR sz = .25 TO 3 STEP .25
  355.     CIRCLE (x2 - 5, y2 - 5), sz, _RGB32(0, 0, 0)
  356.     CIRCLE (x2 + 5, y2 - 5), sz, _RGB32(0, 0, 0)
  357. NEXT sz
  358. LINE (x2 - 5, y2 + 4)-(x2 + 5, y2 + 8), _RGB32(0, 0, 0), BF
  359. _DELAY .004
  360. LINE (x2 - 10, y2 - 10)-(x2 + 10, y2 + 10), _RGB32(0, 0, 0), BF
  361. LINE (x2 - 2, y2 + 10)-(x2 + 2, y2 + 15), _RGB32(0, 0, 0), BF
  362. LINE (x2 - 10, y2 + 15)-(x2 + 10, y2 + 25), _RGB32(0, 0, 0), BF
  363.  
  364. 'Keyboard control for your movement and shooting.
  365. keyboard:
  366. _LIMIT 1000
  367. a$ = INKEY$
  368. IF a$ = CHR$(27) THEN END
  369. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: l = 0
  370. IF r = 1 THEN
  371.     FOR sz = .25 TO 10 STEP .25
  372.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  373.     NEXT sz
  374.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  375.     xt = xt + 1
  376.     IF xt > 780 THEN xt = 780
  377.     FOR sz = .25 TO 10 STEP .25
  378.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  379.     NEXT sz
  380.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  381. IF a$ = CHR$(0) + CHR$(75) THEN l = 1: r = 0
  382. IF l = 1 THEN
  383.     FOR sz = .25 TO 10 STEP .25
  384.         CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  385.     NEXT sz
  386.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  387.     xt = xt - 1
  388.     IF xt < 0 THEN xt = 0
  389.     FOR sz = .25 TO 10 STEP .25
  390.         CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  391.     NEXT sz
  392.     LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  393. IF a$ = CHR$(0) + CHR$(72) OR a$ = CHR$(0) + CHR$(80) THEN
  394.     r = 0: l = 0
  395.  
  396. IF a$ = " " THEN GOSUB youshoot:
  397.  
  398. 'The start of your shot.
  399. youshoot:
  400. _LIMIT 1000
  401.  
  402. 'sx2 and sy2 are your shot coordinates.
  403. IF ushoot = 0 THEN
  404.     sx2 = xt + 10
  405.     sy2 = yt - 20
  406.     ushoot = 1
  407.     SOUND 400, .5
  408.  
  409. 'The drawing and movement of your shot and if it reaches the enemy.
  410. youshoot2:
  411. _LIMIT 1000
  412. IF ushoot = 1 THEN
  413.     FOR sz = .25 TO 5 STEP .25
  414.         CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  415.     NEXT sz
  416.     sy2 = sy2 - 3
  417.     IF sy2 < 0 THEN ushoot = 0: RETURN
  418.     FOR szz = .25 TO 5 STEP .25
  419.         CIRCLE (sx2, sy2), szz, _RGB32(255, 0, 0)
  420.     NEXT szz
  421.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 0 THEN
  422.         ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  423.         FOR sz = .25 TO 5 STEP .25
  424.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  425.         NEXT sz
  426.         GOSUB redrawshooter:
  427.         points = points + 100
  428.         e1 = 1
  429.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  430.             level = level + 1
  431.             level2 = level2 + 1
  432.             e1 = 0: E2 = 0: e3 = 0
  433.         END IF
  434.         lives$ = STR$(lives)
  435.         points$ = STR$(points)
  436.         level$ = STR$(level2)
  437.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  438.         ushoot = 0
  439.         GOTO go:
  440.     END IF
  441.     IF sx2 > x5 - 21 AND sx2 < x5 + 41 AND sy2 > y5 - 11 AND sy2 < y5 + 21 AND E2 = 0 AND boss = 0 THEN
  442.         ENEMYEXPLOSION2 sx2, sy2, x5, y5, sx3, sy3
  443.         FOR sz = .25 TO 5 STEP .25
  444.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  445.         NEXT sz
  446.         GOSUB redrawshooter:
  447.         points = points + 100
  448.         E2 = 1
  449.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  450.             level = level + 1
  451.             level2 = level2 + 1
  452.             e1 = 0: E2 = 0: e3 = 0
  453.         END IF
  454.         lives$ = STR$(lives)
  455.         points$ = STR$(points)
  456.         level$ = STR$(level2)
  457.         _TITLE "Tech Invaders 2      Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  458.         ushoot = 0
  459.         GOTO go:
  460.     END IF
  461.     IF sx2 > x6 - 21 AND sx2 < x6 + 41 AND sy2 > y6 - 11 AND sy2 < y6 + 21 AND e3 = 0 AND boss = 0 THEN
  462.         ENEMYEXPLOSION3 sx2, sy2, x6, y6, sx4, sy4
  463.         FOR sz = .25 TO 5 STEP .25
  464.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  465.         NEXT sz
  466.         GOSUB redrawshooter:
  467.         points = points + 100
  468.         e3 = 1
  469.         IF e1 = 1 AND E2 = 1 AND e3 = 1 THEN
  470.             level = level + 1
  471.             level2 = level2 + 1
  472.             e1 = 0: E2 = 0: e3 = 0
  473.         END IF
  474.         lives$ = STR$(lives)
  475.         points$ = STR$(points)
  476.         level$ = STR$(level2)
  477.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  478.         ushoot = 0
  479.         GOTO go:
  480.     END IF
  481.  
  482.     'To see if you hit the Boss.
  483.     IF sx2 > x2 - 21 AND sx2 < x2 + 41 AND sy2 > y2 - 11 AND sy2 < y2 + 21 AND e1 = 0 AND boss = 1 THEN
  484.         B = B + 1
  485.         BB = 10 - B
  486.         LOCATE 3, 3: PRINT "BOSS ROBOT:"
  487.         IF bx = 0 THEN GOTO bxx:
  488.         LINE (150, 30)-(bx + 150, 50), _RGB32(0, 0, 0), BF
  489.         bxx:
  490.         bx = BB * 10
  491.         IF bx < 0 THEN GOTO bxx2:
  492.         LINE (150, 30)-(bx + 150, 50), _RGB32(227, 0, 0), BF
  493.         bxx2:
  494.         SOUND 100, 1
  495.         points = points + 100
  496.         lives$ = STR$(lives)
  497.         points$ = STR$(points)
  498.         level$ = STR$(level2)
  499.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  500.         FOR sz = .25 TO 5 STEP .25
  501.             CIRCLE (sx2, sy2), sz, _RGB32(0, 0, 0)
  502.         NEXT sz
  503.         IF B > 10 THEN ENEMYEXPLOSION sx2, sy2, x2, y2, sx, sy
  504.         IF B < 11 THEN ushoot = 0: RETURN
  505.         LINE (0, 0)-(800, 200), _RGB32(0, 0, 0), BF
  506.         GOSUB redrawshooter:
  507.         bx = 0
  508.         BB = 0
  509.         B = 0
  510.         boss = 0
  511.         points = points + 1000
  512.         level = level + 1
  513.         level2 = level2 + 1
  514.         e1 = 0: E2 = 0: e3 = 0
  515.         lives$ = STR$(lives)
  516.         points$ = STR$(points)
  517.         level$ = STR$(level2)
  518.         _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  519.         ushoot = 0
  520.         GOTO go:
  521.     END IF
  522.  
  523. redrawshooter:
  524. FOR sz = .25 TO 10 STEP .25
  525.     CIRCLE (xt + 10, yt), sz, _RGB32(139, 249, 255)
  526. NEXT sz
  527. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(139, 249, 255), BF
  528.  
  529. 'The enemy's shot and if it reaches you.
  530. shoot:
  531. _LIMIT 1000
  532. IF shooting = 0 AND e1 = 0 THEN
  533.     GOSUB checktoshoot:
  534.     sh = INT(RND * 10000) + 1
  535.     IF sh < shh THEN GOTO nexone:
  536.     'sx and sy are the first enemy shot coordinates.
  537.     sx = x2 + 10
  538.     sy = y2 + 10
  539.     shooting = 1
  540.     SOUND 300, .5
  541. nexone:
  542. IF shooting2 = 0 AND E2 = 0 THEN
  543.     GOSUB checktoshoot:
  544.     sh2 = INT(RND * 10000) + 1
  545.     IF sh2 < shh THEN GOTO nexone2:
  546.  
  547.     'sx3 and sy3 are the second enemy shot coordinates.
  548.     sx3 = x5 + 10
  549.     sy3 = y5 + 10
  550.     shooting2 = 1
  551.     SOUND 300, .5
  552. nexone2:
  553. IF shooting3 = 0 AND e3 = 0 THEN
  554.     GOSUB checktoshoot:
  555.     sh3 = INT(RND * 10000) + 1
  556.     IF sh3 < shh THEN GOTO nexone3:
  557.  
  558.     'sx4 and sy4 are the third enemy shot coordinates.
  559.     sx4 = x6 + 10
  560.     sy4 = y6 + 10
  561.     shooting3 = 1
  562.     SOUND 300, .5
  563.  
  564. nexone3:
  565. 'To see if first enemy hit you.
  566. IF shooting = 1 AND e1 = 0 THEN
  567.     FOR sz2 = .25 TO 5 STEP .25
  568.         CIRCLE (sx, sy), sz2, _RGB32(0, 0, 0)
  569.     NEXT sz2
  570.     sy = sy + 3
  571.     IF sy > 620 THEN shooting = 0: GOTO nex4:
  572.     FOR szz2 = .25 TO 5 STEP .25
  573.         CIRCLE (sx, sy), szz2, _RGB32(255, 0, 0)
  574.     NEXT szz2
  575.     IF sx > xt - 1 AND sx < xt + 21 AND sy > yt - 1 AND sy < yt + 21 THEN
  576.         FOR sz3 = .25 TO 5 STEP .25
  577.             CIRCLE (sx, sy), sz3, _RGB32(0, 0, 0)
  578.         NEXT sz3
  579.         shooting = 0
  580.         GOSUB explosion:
  581.     END IF
  582. nex4:
  583.  
  584. 'To see if second enemy hit you.
  585. IF shooting2 = 1 AND E2 = 0 THEN
  586.     FOR sz2 = .25 TO 5 STEP .25
  587.         CIRCLE (sx3, sy3), sz2, _RGB32(0, 0, 0)
  588.     NEXT sz2
  589.     sy3 = sy3 + 3
  590.     IF sy3 > 620 THEN shooting2 = 0: GOTO nexx:
  591.     FOR szz2 = .25 TO 5 STEP .25
  592.         CIRCLE (sx3, sy3), szz2, _RGB32(255, 0, 0)
  593.     NEXT szz2
  594.     IF sx3 > xt - 1 AND sx3 < xt + 21 AND sy3 > yt - 1 AND sy3 < yt + 21 THEN
  595.         FOR sz3 = .25 TO 5 STEP .25
  596.             CIRCLE (sx3, sy3), sz3, _RGB32(0, 0, 0)
  597.         NEXT sz3
  598.         shooting2 = 0
  599.         GOSUB explosion:
  600.     END IF
  601.  
  602. nexx:
  603. 'To see if third enemy hit you.
  604. IF shooting3 = 1 AND e3 = 0 THEN
  605.     FOR sz2 = .25 TO 5 STEP .25
  606.         CIRCLE (sx4, sy4), sz2, _RGB32(0, 0, 0)
  607.     NEXT sz2
  608.     sy4 = sy4 + 3
  609.     IF sy4 > 620 THEN shooting3 = 0: RETURN
  610.     FOR szz2 = .25 TO 5 STEP .25
  611.         CIRCLE (sx4, sy4), szz2, _RGB32(255, 0, 0)
  612.     NEXT szz2
  613.     IF sx4 > xt - 1 AND sx4 < xt + 21 AND sy4 > yt - 1 AND sy4 < yt + 21 THEN
  614.         FOR sz3 = .25 TO 5 STEP .25
  615.             CIRCLE (sx4, sy4), sz3, _RGB32(0, 0, 0)
  616.         NEXT sz3
  617.         shooting3 = 0
  618.         GOSUB explosion:
  619.     END IF
  620.  
  621. explosion:
  622. FOR sz = .25 TO 10 STEP .25
  623.     CIRCLE (xt + 10, yt), sz, _RGB32(0, 0, 0)
  624. NEXT sz
  625. LINE (xt + 8, yt - 7)-(xt + 12, yt - 15), _RGB(0, 0, 0), BF
  626. SOUND 400, .5
  627. SOUND 300, .5
  628. SOUND 200, .5
  629. SOUND 100, .5
  630. dxx = (RND * 6) + -3
  631. dyy = (RND * 6) + -3
  632. dxx2 = (RND * 6) + -3
  633. dyy2 = (RND * 6) + -3
  634. dxx3 = (RND * 6) + -3
  635. dyy3 = (RND * 6) + -3
  636. dxx4 = (RND * 6) + -3
  637. dyy4 = (RND * 6) + -3
  638. dxx5 = (RND * 6) + -3
  639. dyy5 = (RND * 6) + -3
  640. dxx6 = (RND * 6) + -3
  641. dyy6 = (RND * 6) + -3
  642. yourexplosion:
  643. DD = DD + 1
  644. dxx = dxx + dxx / 4
  645. dxx2 = dxx2 + dxx2 / 4
  646. dxx3 = dxx3 + dxx3 / 4
  647. dxx4 = dxx4 + dxx4 / 4
  648. dxx5 = dxx5 + dxx5 / 4
  649. dxx6 = dxx6 + dxx6 / 4
  650. dyy = dyy + dyy / 4
  651. dyy2 = dyy2 + dyy2 / 4
  652. dyy3 = dyy3 + dyy3 / 4
  653. dyy4 = dyy4 + dyy4 / 4
  654. dyy5 = dyy5 + dyy5 / 4
  655. dyy6 = dyy6 + dyy6 / 4
  656. LINE (xt + dxx, yt + dyy)-(xt + dxx + 2, yt + dyy + 2), _RGB32(255, 0, 0), BF
  657. LINE (xt + dxx2, yt + dyy2)-(xt + dxx2 + 2, yt + dyy2 + 2), _RGB32(0, 255, 0), BF
  658. LINE (xt + dxx3, yt + dyy3)-(xt + dxx3 + 2, yt + dyy3 + 2), _RGB32(255, 0, 0), BF
  659. LINE (xt + dxx4, yt + dyy4)-(xt + dxx4 + 2, yt + dyy4 + 2), _RGB32(0, 255, 0), BF
  660. LINE (xt + dxx5, yt + dyy5)-(xt + dxx5 + 2, yt + dyy5 + 2), _RGB32(255, 0, 0), BF
  661. LINE (xt + dxx6, yt + dyy6)-(xt + dxx6 + 2, yt + dyy6 + 2), _RGB32(0, 255, 0), BF
  662. _DELAY .02
  663. LINE (xt + dxx, yt + dyy)-(xt + dxx + 2, yt + dyy + 2), _RGB32(0, 0, 0), BF
  664. LINE (xt + dxx2, yt + dyy2)-(xt + dxx2 + 2, yt + dyy2 + 2), _RGB32(0, 0, 0), BF
  665. LINE (xt + dxx3, yt + dyy3)-(xt + dxx3 + 2, yt + dyy3 + 2), _RGB32(0, 0, 0), BF
  666. LINE (xt + dxx4, yt + dyy4)-(xt + dxx4 + 2, yt + dyy4 + 2), _RGB32(0, 0, 0), BF
  667. LINE (xt + dxx5, yt + dyy5)-(xt + dxx5 + 2, yt + dyy5 + 2), _RGB32(0, 0, 0), BF
  668. LINE (xt + dxx6, yt + dyy6)-(xt + dxx6 + 2, yt + dyy6 + 2), _RGB32(0, 0, 0), BF
  669. IF DD > 20 THEN GOTO back2:
  670. GOTO yourexplosion:
  671. back2:
  672. DD = 0
  673. lives = lives - 1
  674. lives$ = STR$(lives)
  675. points$ = STR$(points)
  676. level$ = STR$(level2)
  677. _TITLE "Tech Invaders 2     Lives: " + lives$ + "     Level: " + level$ + "      Score: " + points$
  678. LINE (xt - 22, yt - 42)-(xt + 42, yt + 42), _RGB32(0, 0, 0), BF
  679. GOSUB redrawshooter:
  680. IF lives = 0 THEN
  681.     LOCATE 20, 40: PRINT "G A M E   O V E R"
  682.     LOCATE 22, 40: PRINT "Score: "; points
  683.     LOCATE 23, 40: PRINT "Level: "; level2
  684.     LOCATE 25, 40: INPUT "Press Enter to go to Top Ten Scores.", tt$
  685.  
  686.     'Top Ten Scores
  687.     scc = points
  688.     IF _FILEEXISTS("toptentech.txt") THEN
  689.     ELSE
  690.         OPEN "toptentech.txt" FOR OUTPUT AS #1
  691.         RESTORE originaltopten
  692.         DO
  693.             READ toptenname$, toptenscore!
  694.             IF toptenname$ = "EOF" THEN EXIT DO
  695.             PRINT #1, toptenname$
  696.             PRINT #1, toptenscore!
  697.         LOOP
  698.         CLOSE #1
  699.     END IF
  700.  
  701.     OPEN "toptentech.txt" FOR INPUT AS #1
  702.     FOR n = 1 TO 10
  703.         INPUT #1, name$(n)
  704.         INPUT #1, score(n)
  705.         IF scc > score(n) AND sct = 0 THEN
  706.             NN = n
  707.             PRINT "You have made the Top Ten!"
  708.             typename:
  709.             INPUT "Type your name here (25 letters and spaces maximum.):", nm$(NN)
  710.             IF LEN(nm$(NN)) > 25 THEN
  711.                 PRINT "Name too long, try again."
  712.                 GOTO typename:
  713.             END IF
  714.             sccc(NN) = scc
  715.             sct = 1
  716.         END IF
  717.         IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  718.     NEXT n
  719.     CLOSE #1
  720.     nex5:
  721.     CLOSE #1
  722.     OPEN "toptentech.txt" FOR OUTPUT AS #1
  723.     FOR n = 1 TO NN
  724.         IF n <> NN THEN PRINT #1, name$(n): PRINT #1, score(n)
  725.         IF n = NN THEN
  726.             PRINT #1, nm$(n)
  727.             PRINT #1, sccc(n)
  728.         END IF
  729.     NEXT n
  730.     nex6:
  731.     FOR n = NN TO 10
  732.         PRINT #1, name$(n): PRINT #1, score(n)
  733.     NEXT n
  734.     CLOSE #1
  735.     nex7:
  736.     CLS
  737.     PRINT: PRINT: PRINT
  738.     PRINT "                                         T O P    T E N "
  739.     PRINT: PRINT: PRINT
  740.     OPEN "toptentech.txt" FOR INPUT AS #1
  741.     FOR n = 1 TO 10
  742.         IF EOF(1) THEN GOTO nex8:
  743.         INPUT #1, name$(n)
  744.         INPUT #1, score(n)
  745.         PRINT "             "; n; ". "; name$(n); score(n)
  746.     NEXT n
  747.     nex8:
  748.     CLOSE #1
  749.     FOR n = 1 TO 10
  750.         nm$(n) = ""
  751.         score(n) = 0
  752.         name$(n) = ""
  753.         sccc(n) = 0
  754.     NEXT n
  755.     NN = 0
  756.     n = 0
  757.     sct = 0
  758.     scc = 0
  759.     LOCATE 23, 1
  760.     INPUT "Would you like to play again? (Yes/No)", ag$
  761.     IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" OR ag$ = "YEs" THEN GOTO begin:
  762.     END
  763. OPENINGSOUND
  764.  
  765. checktoshoot:
  766. IF level2 = 1 THEN shh = 9950
  767. IF level2 = 2 THEN shh = 9945
  768. IF level2 = 3 THEN shh = 9940
  769. IF level2 = 4 THEN shh = 9935
  770. IF level2 = 5 THEN shh = 9930
  771. IF level2 = 6 THEN shh = 9925
  772. IF level2 > 6 THEN shh = 9920
  773.  
  774. originaltopten:
  775. DATA Space Ace,7000
  776. DATA Suzy Swift,6000
  777. DATA Speedy Spencer,5000
  778. DATA Super Sam,4000
  779. DATA Battery Bob,3000
  780. DATA Karen Kryptonite,2750
  781. DATA Quick Ken,2500
  782. DATA Tiger Tessa,2250
  783. DATA Arcade Joe,2000
  784. DATA How Do U Play,1750
  785.  
  786. SUB OPENINGSOUND
  787.     snd = 300
  788.     snd2 = 800
  789.     FOR t = 1 TO 50
  790.         IF snd > 800 THEN snd = 300
  791.         IF snd2 < 300 THEN snd2 = 800
  792.         snd = snd + 10
  793.         SOUND snd, .25
  794.     NEXT t
  795.  
  796. SUB ENEMYEXPLOSION (sx2, sy2, x2, y2, sx, sy)
  797.     FOR sz4 = .25 TO 5 STEP .25
  798.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  799.     NEXT sz4
  800.     SOUND 400, .5
  801.     SOUND 300, .5
  802.     SOUND 200, .5
  803.     SOUND 100, .5
  804.     dxx = (RND * 6) + -3
  805.     dyy = (RND * 6) + -3
  806.     dxx2 = (RND * 6) + -3
  807.     dyy2 = (RND * 6) + -3
  808.     dxx3 = (RND * 6) + -3
  809.     dyy3 = (RND * 6) + -3
  810.     dxx4 = (RND * 6) + -3
  811.     dyy4 = (RND * 6) + -3
  812.     dxx5 = (RND * 6) + -3
  813.     dyy5 = (RND * 6) + -3
  814.     dxx6 = (RND * 6) + -3
  815.     dyy6 = (RND * 6) + -3
  816.     explosion1:
  817.     dd = dd + 1
  818.     dxx = dxx + dxx / 4
  819.     dxx2 = dxx2 + dxx2 / 4
  820.     dxx3 = dxx3 + dxx3 / 4
  821.     dxx4 = dxx4 + dxx4 / 4
  822.     dxx5 = dxx5 + dxx5 / 4
  823.     dxx6 = dxx6 + dxx6 / 4
  824.     dyy = dyy + dyy / 4
  825.     dyy2 = dyy2 + dyy2 / 4
  826.     dyy3 = dyy3 + dyy3 / 4
  827.     dyy4 = dyy4 + dyy4 / 4
  828.     dyy5 = dyy5 + dyy5 / 4
  829.     dyy6 = dyy6 + dyy6 / 4
  830.     LINE (x2 + dxx, y2 + dyy)-(x2 + dxx + 2, y2 + dyy + 2), _RGB32(255, 0, 0), BF
  831.     LINE (x2 + dxx2, y2 + dyy2)-(x2 + dxx2 + 2, y2 + dyy2 + 2), _RGB32(0, 255, 0), BF
  832.     LINE (x2 + dxx3, y2 + dyy3)-(x2 + dxx3 + 2, y2 + dyy3 + 2), _RGB32(255, 0, 0), BF
  833.     LINE (x2 + dxx4, y2 + dyy4)-(x2 + dxx4 + 2, y2 + dyy4 + 2), _RGB32(0, 255, 0), BF
  834.     LINE (x2 + dxx5, y2 + dyy5)-(x2 + dxx5 + 2, y2 + dyy5 + 2), _RGB32(255, 0, 0), BF
  835.     LINE (x2 + dxx6, y2 + dyy6)-(x2 + dxx6 + 2, y2 + dyy6 + 2), _RGB32(0, 255, 0), BF
  836.     _DELAY .02
  837.     LINE (x2 + dxx, y2 + dyy)-(x2 + dxx + 2, y2 + dyy + 2), _RGB32(0, 0, 0), BF
  838.     LINE (x2 + dxx2, y2 + dyy2)-(x2 + dxx2 + 2, y2 + dyy2 + 2), _RGB32(0, 0, 0), BF
  839.     LINE (x2 + dxx3, y2 + dyy3)-(x2 + dxx3 + 2, y2 + dyy3 + 2), _RGB32(0, 0, 0), BF
  840.     LINE (x2 + dxx4, y2 + dyy4)-(x2 + dxx4 + 2, y2 + dyy4 + 2), _RGB32(0, 0, 0), BF
  841.     LINE (x2 + dxx5, y2 + dyy5)-(x2 + dxx5 + 2, y2 + dyy5 + 2), _RGB32(0, 0, 0), BF
  842.     LINE (x2 + dxx6, y2 + dyy6)-(x2 + dxx6 + 2, y2 + dyy6 + 2), _RGB32(0, 0, 0), BF
  843.     IF dd > 20 THEN GOTO goingback
  844.     GOTO explosion1:
  845.     goingback:
  846.     dd = 0
  847.     LINE (x2 - 21, y2 - 21)-(x2 + 41, y2 + 41), _RGB32(0, 0, 0), BF
  848.     FOR sz4 = .25 TO 5 STEP .25
  849.         CIRCLE (sx2, sy2), sz4, _RGB32(0, 0, 0)
  850.     NEXT sz4
  851.     FOR sz4 = .25 TO 5 STEP .25
  852.         CIRCLE (sx, sy), sz4, _RGB32(0, 0, 0)
  853.     NEXT sz4
  854.  
  855. SUB ENEMYEXPLOSION2 (sx2, sy2, x5, y5, sx3, sy3)
  856.     FOR sz5 = .25 TO 5 STEP .25
  857.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  858.     NEXT sz5
  859.     SOUND 400, .5
  860.     SOUND 300, .5
  861.     SOUND 200, .5
  862.     SOUND 100, .5
  863.     dxx = (RND * 6) + -3
  864.     dyy = (RND * 6) + -3
  865.     dxx2 = (RND * 6) + -3
  866.     dyy2 = (RND * 6) + -3
  867.     dxx3 = (RND * 6) + -3
  868.     dyy3 = (RND * 6) + -3
  869.     dxx4 = (RND * 6) + -3
  870.     dyy4 = (RND * 6) + -3
  871.     dxx5 = (RND * 6) + -3
  872.     dyy5 = (RND * 6) + -3
  873.     dxx6 = (RND * 6) + -3
  874.     dyy6 = (RND * 6) + -3
  875.     explosion2:
  876.     dd = dd + 1
  877.     dxx = dxx + dxx / 4
  878.     dxx2 = dxx2 + dxx2 / 4
  879.     dxx3 = dxx3 + dxx3 / 4
  880.     dxx4 = dxx4 + dxx4 / 4
  881.     dxx5 = dxx5 + dxx5 / 4
  882.     dxx6 = dxx6 + dxx6 / 4
  883.     dyy = dyy + dyy / 4
  884.     dyy2 = dyy2 + dyy2 / 4
  885.     dyy3 = dyy3 + dyy3 / 4
  886.     dyy4 = dyy4 + dyy4 / 4
  887.     dyy5 = dyy5 + dyy5 / 4
  888.     dyy6 = dyy6 + dyy6 / 4
  889.     LINE (x5 + dxx, y5 + dyy)-(x5 + dxx + 2, y5 + dyy + 2), _RGB32(255, 0, 0), BF
  890.     LINE (x5 + dxx2, y5 + dyy2)-(x5 + dxx2 + 2, y5 + dyy2 + 2), _RGB32(0, 255, 0), BF
  891.     LINE (x5 + dxx3, y5 + dyy3)-(x5 + dxx3 + 2, y5 + dyy3 + 2), _RGB32(255, 0, 0), BF
  892.     LINE (x5 + dxx4, y5 + dyy4)-(x5 + dxx4 + 2, y5 + dyy4 + 2), _RGB32(0, 255, 0), BF
  893.     LINE (x5 + dxx5, y5 + dyy5)-(x5 + dxx5 + 2, y5 + dyy5 + 2), _RGB32(255, 0, 0), BF
  894.     LINE (x5 + dxx6, y5 + dyy6)-(x5 + dxx6 + 2, y5 + dyy6 + 2), _RGB32(0, 255, 0), BF
  895.     _DELAY .02
  896.     LINE (x5 + dxx, y5 + dyy)-(x5 + dxx + 2, y5 + dyy + 2), _RGB32(0, 0, 0), BF
  897.     LINE (x5 + dxx2, y5 + dyy2)-(x5 + dxx2 + 2, y5 + dyy2 + 2), _RGB32(0, 0, 0), BF
  898.     LINE (x5 + dxx3, y5 + dyy3)-(x5 + dxx3 + 2, y5 + dyy3 + 2), _RGB32(0, 0, 0), BF
  899.     LINE (x5 + dxx4, y5 + dyy4)-(x5 + dxx4 + 2, y5 + dyy4 + 2), _RGB32(0, 0, 0), BF
  900.     LINE (x5 + dxx5, y5 + dyy5)-(x5 + dxx5 + 2, y5 + dyy5 + 2), _RGB32(0, 0, 0), BF
  901.     LINE (x5 + dxx6, y5 + dyy6)-(x5 + dxx6 + 2, y5 + dyy6 + 2), _RGB32(0, 0, 0), BF
  902.     IF dd > 20 THEN GOTO goingback2:
  903.     GOTO explosion2:
  904.     goingback2:
  905.     dd = 0
  906.     LINE (x5 - 21, y5 - 21)-(x5 + 41, y5 + 41), _RGB32(0, 0, 0), BF
  907.     FOR sz5 = .25 TO 5 STEP .25
  908.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  909.     NEXT sz5
  910.     FOR sz5 = .25 TO 5 STEP .25
  911.         CIRCLE (sx3, sy3), sz5, _RGB32(0, 0, 0)
  912.     NEXT sz5
  913.  
  914. SUB ENEMYEXPLOSION3 (sx2, sy2, x6, y6, sx4, sy4)
  915.     FOR sz6 = .25 TO 5 STEP .25
  916.         CIRCLE (sx2, sy2), sz6, _RGB32(0, 0, 0)
  917.     NEXT sz6
  918.     SOUND 400, .5
  919.     SOUND 300, .5
  920.     SOUND 200, .5
  921.     SOUND 100, .5
  922.     dxx = (RND * 6) + -3
  923.     dyy = (RND * 6) + -3
  924.     dxx2 = (RND * 6) + -3
  925.     dyy2 = (RND * 6) + -3
  926.     dxx3 = (RND * 6) + -3
  927.     dyy3 = (RND * 6) + -3
  928.     dxx4 = (RND * 6) + -3
  929.     dyy4 = (RND * 6) + -3
  930.     dxx5 = (RND * 6) + -3
  931.     dyy5 = (RND * 6) + -3
  932.     dxx6 = (RND * 6) + -3
  933.     dyy6 = (RND * 6) + -3
  934.     explosion3:
  935.     dd = dd + 1
  936.     dxx = dxx + dxx / 4
  937.     dxx2 = dxx2 + dxx2 / 4
  938.     dxx3 = dxx3 + dxx3 / 4
  939.     dxx4 = dxx4 + dxx4 / 4
  940.     dxx5 = dxx5 + dxx5 / 4
  941.     dxx6 = dxx6 + dxx6 / 4
  942.     dyy = dyy + dyy / 4
  943.     dyy2 = dyy2 + dyy2 / 4
  944.     dyy3 = dyy3 + dyy3 / 4
  945.     dyy4 = dyy4 + dyy4 / 4
  946.     dyy5 = dyy5 + dyy5 / 4
  947.     dyy6 = dyy6 + dyy6 / 4
  948.     LINE (x6 + dxx, y6 + dyy)-(x6 + dxx + 2, y6 + dyy + 2), _RGB32(255, 0, 0), BF
  949.     LINE (x6 + dxx2, y6 + dyy2)-(x6 + dxx2 + 2, y6 + dyy2 + 2), _RGB32(0, 255, 0), BF
  950.     LINE (x6 + dxx3, y6 + dyy3)-(x6 + dxx3 + 2, y6 + dyy3 + 2), _RGB32(255, 0, 0), BF
  951.     LINE (x6 + dxx4, y6 + dyy4)-(x6 + dxx4 + 2, y6 + dyy4 + 2), _RGB32(0, 255, 0), BF
  952.     LINE (x6 + dxx5, y6 + dyy5)-(x6 + dxx5 + 2, y6 + dyy5 + 2), _RGB32(255, 0, 0), BF
  953.     LINE (x6 + dxx6, y6 + dyy6)-(x6 + dxx6 + 2, y6 + dyy6 + 2), _RGB32(0, 255, 0), BF
  954.     _DELAY .02
  955.     LINE (x6 + dxx, y6 + dyy)-(x6 + dxx + 2, y6 + dyy + 2), _RGB32(0, 0, 0), BF
  956.     LINE (x6 + dxx2, y6 + dyy2)-(x6 + dxx2 + 2, y6 + dyy2 + 2), _RGB32(0, 0, 0), BF
  957.     LINE (x6 + dxx3, y6 + dyy3)-(x6 + dxx3 + 2, y6 + dyy3 + 2), _RGB32(0, 0, 0), BF
  958.     LINE (x6 + dxx4, y6 + dyy4)-(x6 + dxx4 + 2, y6 + dyy4 + 2), _RGB32(0, 0, 0), BF
  959.     LINE (x6 + dxx5, y6 + dyy5)-(x6 + dxx5 + 2, y6 + dyy5 + 2), _RGB32(0, 0, 0), BF
  960.     LINE (x6 + dxx6, y6 + dyy6)-(x6 + dxx6 + 2, y6 + dyy6 + 2), _RGB32(0, 0, 0), BF
  961.     IF dd > 20 THEN GOTO goingback3:
  962.     GOTO explosion3:
  963.     goingback3:
  964.     dd = 0
  965.     LINE (x6 - 21, y6 - 21)-(x6 + 41, y6 + 41), _RGB32(0, 0, 0), BF
  966.     FOR sz5 = .25 TO 5 STEP .25
  967.         CIRCLE (sx2, sy2), sz5, _RGB32(0, 0, 0)
  968.     NEXT sz5
  969.     FOR sz5 = .25 TO 5 STEP .25
  970.         CIRCLE (sx4, sy4), sz5, _RGB32(0, 0, 0)
  971.     NEXT sz5
  972.  

« Last Edit: May 08, 2020, 01:09:34 pm by SierraKen »