Author Topic: Competition  (Read 35216 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #60 on: October 07, 2021, 03:26:25 pm »
It would need some tweaking to be an actual game. BTW - I only tested it on level 1. Got through it, and I think the next two levels add a bit more difficulty. It's been so long since I've played the real Space Invaders, on an Atari. I think there was a bonus for each time you blew up the mother ship, and probably a set number of points for each alien fighter destroyed. I believe the game also had three barriers you could hide behind, but they were progressively broken apart by alien missiles. I can't remember if they regenerated or not in subsequent levels.

Anyway, if I had to give this thing a name, I'd guess I'd call it, QB64 ASCII Invaders

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: Competition
« Reply #61 on: October 07, 2021, 03:36:49 pm »
Hmm... what if mother ship were an ascii witch or harvest man in the moon and the alien fighters ascii bats?

You know, to get into Halloween spirit and extra credit ;-))

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #62 on: October 07, 2021, 04:24:25 pm »
Consider you guys lucky I didn't code ASCII fighters as: (_|_)

And no, that's not a pumpkin.

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

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #63 on: October 07, 2021, 08:10:57 pm »
Okay, fine...

Halloween theme engaged. Watch out for stormy weather.

Code: QB64: [Select]
  1. DIM SHARED intro%: intro% = -1
  2. skip_intro:
  3. DIM SHARED lmargin%, rmargin%, topmargin%, screenwidth%, level, ibk, ileadingrow
  4. DIM SHARED irow, icol, inextrnd, imaxalienmissiles, alienforce%, ileadingmax, imaxalienforce, ihits, score$
  5.  
  6. score$ = "000000"
  7. imaxalienforce = 6
  8. imaxalienmissiles = 3
  9. lmargin% = 2
  10. rmargin% = 79
  11. topmargin% = 3
  12. ialiencolstat = 6
  13. iwin = 3 ' 3 Levels.
  14. screenwidth% = rmargin% - lmargin% + 1
  15. ibk = 0 ' Background color
  16.  
  17. DIM SHARED a(imaxalienforce) AS STRING * 68
  18.  
  19. SCREEN 0, 0, 0, 0
  20. COLOR 7, 0: CLS
  21.  
  22. REM Make aliens
  23. a1$ = "^^" + CHR$(79) + "^^  "
  24. a$ = a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$
  25.  
  26. IF intro% THEN
  27.     SCREEN 0, 0, 1, 1
  28.     CALL qbideOrig
  29.  
  30.     SCREEN 0, 0, 2, 0
  31.     CALL qbide
  32.  
  33.     SCREEN 0, 0, 1, 1
  34.     _DELAY 2
  35.  
  36.     SOUND 1000, .3: SOUND 2400, .6:: SOUND 700, 2
  37.     FOR i = 1 TO 15
  38.         _DELAY i / 150
  39.         IF i / 2 = i \ 2 THEN
  40.             SOUND 250, .1
  41.             SCREEN 0, 0, 1, 1
  42.         ELSE
  43.             SCREEN 0, 0, 2, 2
  44.             IF i < 13 THEN _DELAY i / 100: SCREEN 0, 0, 3, 3: COLOR 0, 7: CLS
  45.         END IF
  46.     NEXT
  47.     PCOPY 2, 0
  48.     SCREEN 0, 0, 0, 0
  49.     CALL qbide
  50.  
  51. IF intro% = -1 THEN RESTORE first_play ELSE RESTORE replay
  52.  
  53. CALL instructions
  54.  
  55.     IF inextrnd = -1 THEN PCOPY 3, 0
  56.     tank$ = CHR$(218) + CHR$(127) + CHR$(191): icolor = 6
  57.     REDIM SHARED bullet%(5), bulletcol%(5), bulletdelay%(5), iltalien(imaxalienforce)
  58.     REDIM SHARED ia(imaxalienmissiles), iy(imaxalienmissiles), ix(imaxalienmissiles)
  59.     REDIM SHARED matrix(imaxalienforce) AS STRING * 10
  60.     alienforce% = imaxalienforce
  61.     level = .65
  62.     iround = iround + 1
  63.     level = level - iround / 15
  64.     inextrnd = -1
  65.     COLOR 6, ibk
  66.  
  67.     REM Set up aliens
  68.     ialiencol = ialiencolstat
  69.     LOCATE 2, ialiencol
  70.     FOR i = 1 TO imaxalienforce
  71.         IF i MOD 1 = 0 THEN PRINT
  72.         LOCATE , ialiencol
  73.         IF i = imaxalienforce THEN ileadingrow = CSRLIN: ileadingmax = ileadingrow
  74.         a(i) = a$
  75.         PRINT a(i)
  76.     NEXT
  77.  
  78.     COLOR 0 + 16, 3
  79.     LOCATE 25, 68: PRINT "Score ";
  80.     COLOR 0, 3
  81.     PRINT score$;
  82.     COLOR 6, ibk
  83.  
  84.     REM Station
  85.     LOCATE 24, 40
  86.     tanky% = CSRLIN: tankx% = POS(0) + 1
  87.     PRINT tank$;: LOCATE , POS(0) - 2
  88.  
  89.     _DELAY 1
  90.  
  91.     DO
  92.         z1 = TIMER
  93.         DO
  94.             IF zbonus THEN
  95.                 IF ABS(zbonus - TIMER) > 1.5 THEN
  96.                     yy% = CSRLIN: xx% = POS(0)
  97.                     COLOR 6, 0: LOCATE topmargin%, lmargin%: PRINT SPACE$(screenwidth%);
  98.                     LOCATE yy%, xx%
  99.                     zbonus = 0
  100.                 END IF
  101.             END IF
  102.  
  103.             IF topmargin% + ileadingmax - (imaxalienforce * 2) >= topmargin% + 2 THEN
  104.                 IF imothership <> 0 THEN CALL mship(imothership)
  105.             END IF
  106.             IF ABS(TIMER - z1aliens) > level THEN
  107.                 CALL movealiens(ialiencol, ialiencolstat, iresults)
  108.                 z1aliens = TIMER
  109.             END IF
  110.             IF iresults < 0 THEN EXIT DO
  111.             IF ABS(TIMER - z1ia) > .3 THEN CALL alienmissile(iresults): z1ia = TIMER
  112.  
  113.             DEF SEG = 0
  114.             IF PEEK(1047) MOD 16 = 7 OR PEEK(1047) MOD 16 = 8 THEN
  115.                 key$ = CHR$(32) ' Alt
  116.             ELSE
  117.                 key$ = ""
  118.             END IF
  119.             DEF SEG
  120.  
  121.             SELECT CASE key$
  122.                 CASE CHR$(32)
  123.                     IF flag = 0 THEN switch = switch * -1 - 1: flag = -1
  124.                     SELECT CASE switch
  125.                         CASE 0
  126.                             IF ABS(z9 - TIMER) > .15 THEN
  127.                                 IF POS(0) < screenwidth% THEN COLOR icolor, ibk: LOCATE , POS(0) - 1: PRINT " " + tank$;: LOCATE , POS(0) - 2
  128.                                 tanky% = CSRLIN: tankx% = POS(0)
  129.                                 IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  130.                                 z9 = TIMER
  131.                             END IF
  132.                         CASE -1
  133.                             IF ABS(z9 - TIMER) > .15 THEN
  134.                                 IF POS(0) > lmargin% + 1 THEN COLOR icolor, ibk: LOCATE , POS(0) - 2: PRINT tank$ + " ";: LOCATE , POS(0) - 3
  135.                                 tanky% = CSRLIN: tankx% = POS(0)
  136.                                 IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  137.                                 z9 = TIMER
  138.                             END IF
  139.                     END SELECT
  140.                     IF icolor = 6 THEN
  141.                         FOR i2 = 1 TO 5
  142.                             IF bullet%(i2) = 0 THEN
  143.                                 icolor = 12: COLOR icolor, ibk: GOSUB redraw
  144.                                 bullet%(i2) = -1: reload = TIMER: EXIT FOR
  145.                             END IF
  146.                         NEXT
  147.                     END IF
  148.                 CASE ""
  149.                     IF flag THEN skip = 0: flag = 0
  150.                 CASE CHR$(27): SYSTEM
  151.             END SELECT
  152.  
  153.             IF ABS(z1 - reload) > .6 AND reload <> 0 THEN
  154.                 GOSUB redraw
  155.                 icolor = 6: reload = 0
  156.             END IF
  157.  
  158.             REM Fire
  159.             FOR i = 1 TO 5
  160.                 SELECT CASE bullet%(i)
  161.                     CASE -1: bullet%(i) = tanky% - 1: bulletcol%(i) = tankx%
  162.                     CASE IS > 0
  163.                         IF bulletdelay%(i) = -1 OR bullet%(i) = tanky% - 1 THEN
  164.                             CALL checkcollision(ihitaliens, ialiencol, i4, i)
  165.                             z2bullet = TIMER: bulletdelay%(i) = 0
  166.                             COLOR 6, ibk
  167.                             LOCATE bullet%(i), bulletcol%(i)
  168.                             IF bullet%(i) = topmargin% AND imothership <> 0 THEN ' Hit mother ship.
  169.                                 IF SCREEN(ABS(bullet%(i)), bulletcol%(i)) <> 32 THEN
  170.                                     SOUND 1000, .75
  171.                                     SELECT CASE iresults + 1
  172.                                         CASE 1: bonus = 1500
  173.                                         CASE 2: bonus = 2500
  174.                                         CASE 3: bonus = 5000
  175.                                     END SELECT
  176.                                     score$ = LTRIM$(STR$(VAL(score$) + bonus))
  177.                                     score$ = STRING$(6 - LEN(score$), "0") + score$
  178.                                     yy% = CSRLIN: xx% = POS(0)
  179.                                     SOUND 800, .5: SOUND 1600, .5: SOUND 2400, .5
  180.                                     LOCATE topmargin%, lmargin%: PRINT SPACE$(screenwidth%);
  181.                                     kbonus = bulletcol%(i) - 4
  182.                                     IF kbonus < lmargin% THEN kbonus = lmargin%
  183.                                     IF kbonus + 10 > screenwidth% THEN kbonus = screenwidth% - 11
  184.                                     zbonus = TIMER
  185.                                     LOCATE yy%, xx%
  186.                                     imothership = 0
  187.                                 END IF
  188.                             END IF
  189.                             PRINT CHR$(24) ' Tank missile.
  190.                             IF CSRLIN <> 24 THEN LOCATE , bulletcol%(i): PRINT " ";
  191.                             IF ihitaliens <> 0 THEN CALL reprintaliens(ialiencol, ihitaliens, iresults, i4, i, imothership)
  192.                             LOCATE tanky%, tankx%
  193.                             IF bullet%(i) > topmargin% THEN
  194.                                 bullet%(i) = bullet%(i) - 1
  195.                             ELSE
  196.                                 GOSUB erasebullet
  197.                             END IF
  198.  
  199.                             IF zbonus THEN
  200.                                 yy% = CSRLIN: xx% = POS(0)
  201.                                 LOCATE topmargin%, kbonus: COLOR 2 + 16: PRINT "BONUS " + LTRIM$(STR$(bonus));
  202.                                 LOCATE yy%, xx%
  203.                             END IF
  204.  
  205.                         END IF
  206.                 END SELECT
  207.             NEXT
  208.  
  209.             REM Bullet timer delay
  210.             IF z2bullet <> 0 THEN
  211.                 IF z1 < z2bullet THEN z2bullet = z2bullet - 86400
  212.                 IF z1 - z2bullet >= .06 THEN
  213.                     FOR i2 = 1 TO 5
  214.                         IF bullet%(i2) <> 0 THEN bulletdelay%(i2) = -1
  215.                     NEXT i2
  216.                 END IF
  217.                 EXIT DO
  218.             END IF
  219.         LOOP
  220.         IF iresults < 0 THEN EXIT DO
  221.         IF alienforce% = 0 OR iresults = iwin THEN
  222.             FOR i = 1 TO imaxalienmissiles
  223.                 IF ia(i) <> 0 THEN EXIT FOR
  224.             NEXT
  225.             IF i > imaxalienmissiles THEN iwait = -1
  226.             IF iwait = -1 THEN
  227.                 EXIT DO
  228.             END IF
  229.         ELSE
  230.             iwait = 1
  231.         END IF
  232.     LOOP
  233.  
  234.     IF iresults = iwin OR iresults < 0 THEN
  235.         REM end game
  236.         EXIT DO
  237.     END IF
  238.     inextrnd = -1
  239.  
  240. SELECT CASE iresults
  241.     CASE -1 ' Tank destroyed!
  242.         SOUND 800, .3: SOUND 250, 1
  243.  
  244.         FOR i = 1 TO 5
  245.             COLOR 14, 4
  246.             LOCATE tanky%, tankx% - 1: PRINT tank$;
  247.             _DELAY .1
  248.  
  249.             COLOR 8, ibk
  250.             LOCATE tanky%, tankx% - 1: PRINT tank$;
  251.             _DELAY .1
  252.         NEXT
  253.  
  254.         COLOR 6, ibk
  255.         LOCATE tanky% - 1, lmargin%
  256.         PRINT SPACE$(screenwidth%);
  257.         LOCATE tanky%, lmargin%
  258.         PRINT SPACE$(screenwidth%);
  259.  
  260.         _DELAY 2
  261.  
  262.         CALL qbide
  263.  
  264.     CASE -2 ' Aliens have landed!
  265.         SOUND 1000, .3: SOUND 2400, .6:: SOUND 700, 2
  266.  
  267.         COLOR 7, 0
  268.         FOR i = 0 TO 21 ' Blank out screen.
  269.             LOCATE topmargin% + i, lmargin%: PRINT SPACE$(screenwidth%);
  270.         NEXT
  271.  
  272.         COLOR 6, ibk
  273.         LOCATE tanky% - 1, lmargin%
  274.         PRINT SPACE$(screenwidth%);
  275.         LOCATE tanky%, lmargin%
  276.         PRINT SPACE$(screenwidth%);
  277.  
  278.         COLOR 8, ibk
  279.  
  280.         FOR j = imaxalienforce TO 1 STEP -1
  281.             IF a(j) <> "" THEN EXIT FOR
  282.         NEXT
  283.  
  284.         FOR i = j TO 1 STEP -1
  285.             LOCATE , ialiencol + INSTR(a(i), "^^")
  286.             PRINT LTRIM$(RTRIM$(a(i)));
  287.             LOCATE CSRLIN - 1
  288.         NEXT
  289.  
  290.         _DELAY 2.5
  291.  
  292.     CASE ELSE ' Winner.
  293.  
  294.         l$ = "12"
  295.         n$ = "n29": PLAY "L" + l$ + n$: _DELAY .5
  296.         n$ = "n24": PLAY "L" + l$ + n$: _DELAY .5
  297.         n$ = "n33": PLAY "L" + l$ + n$: _DELAY .5
  298.         n$ = "n29": PLAY "L" + l$ + n$
  299.  
  300.         CALL qbide
  301.  
  302.         RESTORE winner
  303.  
  304.  
  305.  
  306. COLOR 0, 3
  307. LOCATE 25, 68: PRINT "Score "; score$;
  308.  
  309. CALL instructions
  310.  
  311. COLOR 6, 0
  312. LOCATE 5, 3: PRINT "Score "; score$
  313.  
  314. DEF SEG = 0
  315.     _LIMIT 30
  316.     b$ = INKEY$
  317.     IF b$ = CHR$(27) THEN SYSTEM
  318.     IF PEEK(1047) MOD 16 = 7 OR PEEK(1047) MOD 16 = 8 THEN EXIT DO
  319.  
  320. RUN skip_intro
  321.  
  322. erasebullet:
  323. LOCATE ABS(bullet%(i)), bulletcol%(i): PRINT " ";
  324. bullet%(i) = 0: bulletcol%(i) = 0: bulletdelay%(i) = 0
  325. LOCATE tanky%, tankx%
  326.  
  327. redraw:
  328. COLOR , ibk: LOCATE tanky%, tankx% - 1: PRINT tank$;: LOCATE tanky%, tankx%: COLOR 7, ibk
  329.  
  330. first_play:
  331. DATA "The Great Pumpkin is coming and has fired an EM pulse."
  332. DATA ""
  333. DATA "All that's left working is your Alt key."
  334. DATA ""
  335. DATA "Happy Halloween!"
  336. DATA ""
  337. replay:
  338. DATA "Loading..."
  339. DATA "EOF"
  340. DATA "Game Over. Thanks for playing..."
  341. DATA "EOF2"
  342. winner:
  343. DATA "Congratulations, you saved the planet!"
  344. DATA "EOF3"
  345.  
  346.  
  347. SUB alienattack (ialiencol)
  348.     z2alienfire = TIMER
  349.  
  350.     i3 = INT(RND * 10)
  351.     FOR i = 1 TO imaxalienmissiles
  352.         IF ia(i) = 0 THEN
  353.             FOR i2 = imaxalienforce TO 1 STEP -1
  354.                 IF RTRIM$(a(i2)) <> "" THEN
  355.                     IF MID$(matrix(i2), i3 + 1, 1) <> "0" THEN
  356.                         i4 = INSTR(i3 * 7 + 1, a(i2), CHR$(79)) + ialiencol
  357.                         EXIT FOR
  358.                     END IF
  359.                 END IF
  360.             NEXT i2
  361.             IF i4 <> 0 THEN
  362.                 ia(i) = (ileadingmax - (imaxalienforce - i2) * 2) * 80 + i4
  363.                 EXIT FOR
  364.             END IF
  365.         END IF
  366.     NEXT i
  367.  
  368.  
  369. SUB alienmissile (iresults)
  370.     irow = CSRLIN: icol = POS(0)
  371.     FOR i = 1 TO imaxalienmissiles
  372.         IF ia(i) <> 0 THEN
  373.             IF iy(i) = 0 THEN
  374.                 iy(i) = ia(i) \ 80: ix(i) = ia(i) MOD 80
  375.                 IF ix(i) = 0 THEN ix(i) = screenwidth%
  376.             END IF
  377.             LOCATE iy(i) + 1, ix(i)
  378.             COLOR 6, ibk
  379.             IF CSRLIN <= 24 THEN
  380.                 IF CSRLIN = 24 THEN IF SCREEN(CSRLIN, ix(i)) <> 32 THEN iresults = -1
  381.                 PRINT CHR$(25);
  382.             ELSE
  383.                 ia(i) = 0
  384.                 LOCATE iy(i), ix(i)
  385.                 PRINT " ";: iy(i) = 0
  386.                 ia(i) = 0
  387.                 LOCATE irow, icol
  388.                 EXIT SUB
  389.             END IF
  390.             LOCATE iy(i), ix(i): PRINT " ";
  391.             iy(i) = iy(i) + 1
  392.         END IF
  393.     NEXT
  394.     LOCATE irow, icol
  395.  
  396.  
  397. SUB checkcollision (ihitaliens, ialiencol, i4, i)
  398.     ihitaliens = 0
  399.     IF ileadingmax MOD 2 = bullet%(i) MOD 2 THEN
  400.         i4 = imaxalienforce - (ileadingmax - bullet%(i)) \ 2
  401.         IF bullet%(i) <= ileadingrow AND i4 > 0 AND i4 <= imaxalienforce THEN
  402.             IF RTRIM$(a(i4)) <> "" THEN
  403.                 IF bulletcol%(i) >= iltalien(i4) AND bulletcol%(i) - ialiencol <= LEN(RTRIM$(a(i4))) THEN
  404.                     IF MID$(a(i4), bulletcol%(i) - ialiencol, 1) > CHR$(32) THEN
  405.                         ihitaliens = bulletcol%(i) - ialiencol + 1
  406.                         i3 = ihitaliens - 7 + 1: IF i3 < 1 THEN i3 = 1: REM count from the "<" symbol.
  407.                         i2 = INSTR(i3 + 1, a(i4), "^" + CHR$(79)) - 1
  408.                         MID$(a(i4), i2, 7) = SPACE$(7)
  409.                         MID$(matrix(i4), (i2 + 1) \ 7 + 1, 1) = "0"
  410.                     END IF
  411.                 END IF
  412.             END IF
  413.         END IF
  414.     END IF
  415.  
  416.     FOR i2 = 1 TO imaxalienmissiles
  417.         IF ia(i2) <> 0 THEN
  418.             IF iy(i2) >= bullet%(i) AND ix(i2) = bulletcol%(i) THEN
  419.                 ihitaliens = -i2
  420.                 EXIT FOR
  421.             END IF
  422.         END IF
  423.     NEXT
  424.  
  425.  
  426. SUB instructions
  427.     IF in$ = "" THEN
  428.         key$ = INKEY$
  429.         LOCATE 3, 3, 1, 7, 0: COLOR 6, ibk
  430.         _DELAY 2
  431.         DO
  432.             READ in$
  433.             IF MID$(in$, 1, 3) = "EOF" THEN EXIT DO
  434.             FOR i = 1 TO LEN(in$)
  435.                 SOUND 400, .07
  436.                 LOCATE , 2 + i
  437.                 PRINT MID$(in$, i, 1);
  438.                 z = TIMER
  439.                 DO
  440.                     IF ABS(z - TIMER) > .08 THEN EXIT DO
  441.                 LOOP
  442.             NEXT
  443.             LOCATE , , 0, 7, 0
  444.             _DELAY 1
  445.             PRINT
  446.             LOCATE , 3
  447.         LOOP
  448.         _DELAY 1
  449.     END IF
  450.  
  451.     IF in$ = "EOF" THEN
  452.         COLOR 7, 0
  453.         FOR i = 0 TO 19 ' Blank out intro message space.
  454.             LOCATE topmargin% + i, lmargin%: PRINT SPACE$(screenwidth%);
  455.         NEXT
  456.         FOR i = 3 TO 24
  457.             LOCATE i, 80: PRINT CHR$(179);
  458.         NEXT
  459.         LOCATE 21, 2: PRINT STRING$(screenwidth%, " ");
  460.         LOCATE 22, 1: PRINT CHR$(179);
  461.         LOCATE 22, 80: PRINT CHR$(179);
  462.         LOCATE 22, 2: PRINT STRING$(screenwidth%, " ");
  463.     ELSE
  464.         COLOR 0, 3
  465.     END IF
  466.  
  467.     IF in$ <> "EOF2" AND iresults <> iwin THEN COLOR 0 + 16, 3 ELSE COLOR 0, 3
  468.     yy% = CSRLIN: xx% = POS(0)
  469.     LOCATE 25, 68: PRINT "Score ";
  470.     COLOR 0, 3
  471.     PRINT score$;
  472.     LOCATE yy%, xx%
  473.  
  474.     PCOPY 0, 3: REM save skin
  475.  
  476.  
  477. SUB marchdown (ialiencol, ialiencolstat, imotion, iresults)
  478.     COLOR 6, ibk
  479.     ileadingrow = ileadingrow + 1
  480.     ileadingmax = ileadingmax + 1
  481.     COLOR 6, ibk
  482.     FOR i = 1 TO imaxalienforce
  483.         REM SOUND 400, .2 ' Level down.
  484.         IF RTRIM$(a(i)) <> "" THEN
  485.             ialiencol = ialiencolstat + imotion
  486.             LOCATE ileadingmax - (imaxalienforce * 2) + i * 2 - 1, lmargin%
  487.             PRINT STRING$(screenwidth%, " ")
  488.             LOCATE , ialiencol + INSTR(a(i), "^^")
  489.             iltalien(i) = POS(0)
  490.             PRINT LTRIM$(RTRIM$(a(i)))
  491.         END IF
  492.     NEXT
  493.     LOCATE irow, icol
  494.     level = level - .025
  495.     IF ileadingrow = 22 THEN iresults = -2 ' Aliens have landed!
  496.  
  497. SUB movealiens (ialiencol, ialiencolstat, iresults)
  498.     STATIC imotion, imarch, imotiondir
  499.  
  500.     SOUND 800, .1: SOUND 200, .33 ' Marching sound.
  501.  
  502.     IF inextrnd = -1 THEN inextrnd = 0: imotion = 0: imarch = 0: imotiondir = 0
  503.     irow = CSRLIN: icol = POS(0)
  504.     yy% = CSRLIN: xx% = POS(0)
  505.     PCOPY 0, 1: SCREEN 0, 0, 1, 0: LOCATE yy%, xx%, 0, 7, 0
  506.     IF imotiondir = 0 THEN imotion = imotion - 1 ELSE imotion = imotion + 1
  507.     COLOR 6, ibk
  508.  
  509.     FOR i = imaxalienforce TO 1 STEP -1
  510.         IF RTRIM$(a(i)) <> "" THEN
  511.             i2 = i2 + 2
  512.             ialiencol = ialiencolstat + imotion
  513.             LOCATE ileadingmax - (imaxalienforce - i) * 2, ialiencol + INSTR(a(i), "^^")
  514.             IF POS(0) = lmargin% THEN imarch = 1
  515.             iltalien(i) = POS(0)
  516.             IF imotiondir = 0 THEN
  517.                 PRINT LTRIM$(RTRIM$(a(i))); " "
  518.             ELSE
  519.                 LOCATE , POS(0) - 1
  520.                 PRINT " "; LTRIM$(RTRIM$(a(i)))
  521.             END IF
  522.             IF ialiencol + LEN(RTRIM$(a(i))) = screenwidth% THEN imarch = -1
  523.         END IF
  524.     NEXT
  525.  
  526.     IF imarch = 1 THEN imotiondir = 1: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  527.     IF imarch = -1 THEN imotiondir = 0: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  528.     IF imarch = 0 THEN
  529.         IF ABS(TIMER - z2alienfire) > firerate THEN
  530.             firerate = (INT(RND * 10) + 1) / 20
  531.             IF iwait = 0 THEN CALL alienattack(ialiencol)
  532.         END IF
  533.     ELSE
  534.         imarch = 0
  535.     END IF
  536.     PCOPY 1, 0: SCREEN 0, 0, 0, 0
  537.     LOCATE irow, icol, 1, 7, 0
  538.  
  539. SUB mship (imothership)
  540.     STATIC x%, mov%, z4, mothership$
  541.  
  542.     yy% = CSRLIN: xx% = POS(0): COLOR 6, ibk
  543.     IF imothership = -1 THEN
  544.         imothership = 1
  545.         x% = lmargin%
  546.         mothership$ = CHR$(254) + CHR$(254) + "O" + CHR$(254) + CHR$(254)
  547.         mov% = 1
  548.     END IF
  549.  
  550.     IF ABS(TIMER - z4) > .05 THEN GOSUB mothership: z4 = TIMER: LOCATE yy%, xx%: EXIT SUB
  551.     LOCATE yy%, xx%
  552.     EXIT SUB
  553.  
  554.     mothership:
  555.     IF x% + LEN(mothership$) = screenwidth% + lmargin% THEN mov% = -1 ELSE IF x% = lmargin% THEN mov% = 1
  556.     x% = x% + mov%
  557.     LOCATE topmargin%, x%
  558.     PRINT mothership$;
  559.     IF x% > 1 AND mov% = 1 THEN
  560.         LOCATE , POS(0) - LEN(mothership$) - 1: PRINT " ";
  561.     END IF
  562.     IF mov% = -1 THEN PRINT " ";
  563.     RETURN
  564.  
  565.  
  566. DEFINT A-H, J-Z
  567. SUB qbide
  568.     PALETTE 2, 59
  569.     COLOR 15, 0
  570.     CLS
  571.  
  572.     COLOR 0, 7
  573.     LOCATE 1, 1
  574.     PRINT SPACE$(80)
  575.     LOCATE 1, 1: PRINT "   File  Edit  View  Search  Run  Debug  Calls  Options                   Help"
  576.  
  577.     COLOR 7, 0 ' Black background.
  578.  
  579.     LOCATE 2, 1: PRINT CHR$(218)
  580.     LOCATE 2, 2: PRINT STRING$(78, CHR$(196))
  581.     LOCATE 2, 80: PRINT CHR$(191)
  582.  
  583.     LOCATE 2, 76: PRINT CHR$(180)
  584.     LOCATE 2, 78: PRINT CHR$(195)
  585.  
  586.     COLOR 0, 7
  587.     LOCATE 2, 77: PRINT CHR$(24)
  588.     LOCATE 2, 36: PRINT " Untitled "
  589.  
  590.     COLOR 7, 0
  591.     FOR Rows = 3 TO 24
  592.         LOCATE Rows, 1: PRINT CHR$(179);
  593.         LOCATE Rows, 80: PRINT CHR$(179);
  594.     NEXT Rows
  595.  
  596.     LOCATE 22, 1: PRINT CHR$(195)
  597.     LOCATE 22, 80: PRINT CHR$(180)
  598.     LOCATE 22, 2: PRINT STRING$(78, CHR$(196))
  599.     LOCATE 22, 35
  600.     PRINT " Immediate "
  601.  
  602.     COLOR 0, 7
  603.     LOCATE 21, 3: PRINT STRING$(76, CHR$(176))
  604.     LOCATE 21, 2: PRINT CHR$(27)
  605.     LOCATE 21, 3: PRINT CHR$(219)
  606.     LOCATE 21, 79: PRINT CHR$(26)
  607.     FOR Rows = 4 TO 19
  608.         LOCATE Rows, 80: PRINT CHR$(176)
  609.     NEXT Rows
  610.     LOCATE 3, 80: PRINT CHR$(24)
  611.     LOCATE 4, 80: PRINT CHR$(219)
  612.     LOCATE 20, 80: PRINT CHR$(25)
  613.  
  614.     COLOR 0, 3: LOCATE 25, 1: PRINT " <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step> ";
  615.     LOCATE 25, 59: PRINT SPACE$(4);
  616.     COLOR 0, 3
  617.     LOCATE 25, 63: PRINT CHR$(179);
  618.     LOCATE 25, 64: PRINT SPACE$(6);
  619.     LOCATE 25, 68: PRINT "C  00001:001 ";
  620.  
  621.  
  622. DEFSNG A-H, J-Z
  623. SUB reprintaliens (ialiencol, ihitaliens, iresults, i4, i, imothership)
  624.     IF ihitaliens > 0 THEN
  625.         ihits = ihits + 1
  626.  
  627.         SELECT CASE iresults + 1
  628.             CASE 1: score$ = LTRIM$(STR$(VAL(score$) + 150))
  629.             CASE 2: score$ = LTRIM$(STR$(VAL(score$) + 250))
  630.             CASE 3: score$ = LTRIM$(STR$(VAL(score$) + 350))
  631.         END SELECT
  632.  
  633.         score$ = STRING$(6 - LEN(score$), "0") + score$
  634.         IF (ihits + 15) MOD 20 = 0 AND imothership = 0 THEN imothership = -1
  635.         LOCATE bullet%(i), lmargin%: PRINT SPACE$(screenwidth%);
  636.         iltalien(i4) = POS(0)
  637.  
  638.         IF RTRIM$(a(i4)) = "" THEN
  639.             alienforce% = alienforce% - 1
  640.             IF alienforce% = 0 THEN iresults = iresults + 1 ' Level completed. Goto to next level.
  641.             IF bullet%(i) = ileadingrow THEN ileadingrow = ileadingrow - 2
  642.         ELSE
  643.             LOCATE bullet%(i), ialiencol + INSTR(a(i4), "^^"): PRINT LTRIM$(RTRIM$(a(i4)))
  644.         END IF
  645.     ELSE
  646.         i2 = ABS(ihitaliens)
  647.         LOCATE iy(i2), ix(i2)
  648.         PRINT " ";: iy(i2) = 0
  649.         ia(i2) = 0
  650.         LOCATE irow, icol
  651.         SOUND 1000, .5
  652.     END IF
  653.  
  654.     ihitaliens = 0
  655.     bullet%(i) = -bullet%(i)
  656.  
  657.     COLOR 0, 3
  658.     yy% = CSRLIN: xx% = POS(0)
  659.     LOCATE 25, 74: PRINT score$;
  660.     LOCATE yy%, xx%
  661.     COLOR 6, ibk
  662.  
  663.  
  664. SUB qbideOrig
  665.     PALETTE 2, 59
  666.     COLOR 15, 1
  667.     CLS
  668.  
  669.     COLOR 0, 7
  670.     LOCATE 1, 1
  671.     PRINT SPACE$(80)
  672.     LOCATE 1, 1: PRINT "   File  Edit  View  Search  Run  Debug  Calls  Options                   Help"
  673.  
  674.     COLOR 7, 1
  675.  
  676.     LOCATE 2, 1: PRINT CHR$(218)
  677.     LOCATE 2, 2: PRINT STRING$(78, CHR$(196))
  678.     LOCATE 2, 80: PRINT CHR$(191)
  679.  
  680.     LOCATE 2, 76: PRINT CHR$(180)
  681.     LOCATE 2, 78: PRINT CHR$(195)
  682.  
  683.     COLOR 1, 7
  684.     LOCATE 2, 77: PRINT CHR$(24)
  685.     LOCATE 2, 36: PRINT " Untitled "
  686.  
  687.     COLOR 7, 1
  688.     FOR Rows = 3 TO 24
  689.         LOCATE Rows, 1: PRINT CHR$(179);
  690.         LOCATE Rows, 80: PRINT CHR$(179);
  691.     NEXT Rows
  692.  
  693.     LOCATE 22, 1: PRINT CHR$(195)
  694.     LOCATE 22, 80: PRINT CHR$(180)
  695.     LOCATE 22, 2: PRINT STRING$(78, CHR$(196))
  696.     LOCATE 22, 35
  697.     PRINT " Immediate "
  698.  
  699.     COLOR 0, 7
  700.     LOCATE 21, 3: PRINT STRING$(76, CHR$(176))
  701.     LOCATE 21, 2: PRINT CHR$(27)
  702.     LOCATE 21, 3: PRINT CHR$(219)
  703.     LOCATE 21, 79: PRINT CHR$(26)
  704.     FOR Rows = 4 TO 19
  705.         LOCATE Rows, 80: PRINT CHR$(176)
  706.     NEXT Rows
  707.     LOCATE 3, 80: PRINT CHR$(24)
  708.     LOCATE 4, 80: PRINT CHR$(219)
  709.     LOCATE 20, 80: PRINT CHR$(25)
  710.  
  711.     COLOR 0, 3: LOCATE 25, 1: PRINT " <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step> ";
  712.     LOCATE 25, 59: PRINT SPACE$(4);
  713.     COLOR 0, 3
  714.     LOCATE 25, 63: PRINT CHR$(179);
  715.     LOCATE 25, 64: PRINT SPACE$(6);
  716.     LOCATE 25, 68: PRINT "C  00001:001 ";
  717.  

Edited: Added scoring with 50 per hit and 500 bonus for mother ship.

Edited: Some sound and visual effects added. You can replay without the intro. Just press the Alt key at Game Over message.  To end, you have to click the "x" in the program window.
« Last Edit: October 08, 2021, 08:52:31 pm by 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: Competition
« Reply #64 on: October 07, 2021, 10:23:19 pm »
Hey I got through level 1 and almost all level 2 with the bats.

Do miss a "Pete" comment at start :-))

Could be colorized a little? Even some Black and White would make the screen pop.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #65 on: October 08, 2021, 04:05:46 pm »
@bplus Ah color? Orange and black are Halloween colors, so I'm not sure what color scheme you are thinking of.

I added a couple of other effects, see edit info.

I wish I was better with SOUND. I would love to have a thunder sound at the beginning, but without including an .ogg file. I added a short note playing routine if the player completes level 3 for the win.

The counter looks like I should truncate it a bit, or maybe try a progressive scoring algorithm. Something simple like 5o- pts per hit on level 1, 200 pts per hit on level 2, and 500 pts per hit on level 3. Same with mother ship. 1000, 2000, and 5000 pt bonus based on level. Any thoughts on scoring?

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: Competition
« Reply #66 on: October 08, 2021, 08:09:21 pm »
Yeah nice changes @Pete. Haven't played game enough for help with scoring, numbers you have look OK.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #67 on: October 08, 2021, 08:58:33 pm »
I found one big, and fixed it. Also added a progressive scoring system.

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

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Competition
« Reply #68 on: October 08, 2021, 09:12:19 pm »
Cool game... Nicely done... Yep. The Alt key does need a little practice... I actually got through the first wave!! For me that's 'Woo Hoo'... lol
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #69 on: October 08, 2021, 09:39:43 pm »
@johnno56 Careful about saying Woo Hoo around here! (Someone could abuse his post privileges).

TheBOB added his thunder sound effects. I did a quick update at QBF and added them: https://www.tapatalk.com/groups/qbasic/viewtopic.php?p=213778#p213778

It made the intro sooooo much better. I left the initial afffect for anyone who does not include the .0gg files.

Pete

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

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #70 on: October 08, 2021, 11:08:03 pm »
Some more cool-aberation with TheBOB. Remember I mentioned "The Great Pumpkin?"

Code: QB64: [Select]
  1. DIM SHARED intro%: intro% = -1
  2. skip_intro:
  3. DIM SHARED lmargin%, rmargin%, topmargin%, screenwidth%, level, ibk, ileadingrow
  4. DIM SHARED irow, icol, inextrnd, imaxalienmissiles, alienforce%, ileadingmax, imaxalienforce, ihits, score$
  5.  
  6. score$ = "000000"
  7. imaxalienforce = 6
  8. imaxalienmissiles = 3
  9. lmargin% = 2
  10. rmargin% = 79
  11. topmargin% = 3
  12. ialiencolstat = 6
  13. iwin = 3 ' 3 Levels.
  14. screenwidth% = rmargin% - lmargin% + 1
  15. ibk = 0 ' Background color
  16.  
  17. DIM SHARED a(imaxalienforce) AS STRING * 68
  18.  
  19. SCREEN 0, 0, 0, 0
  20. COLOR 7, 0: CLS
  21.  
  22. REM Make aliens
  23. a1$ = "^^" + CHR$(79) + "^^  "
  24. a$ = a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$
  25.  
  26. IF intro% THEN
  27.     SCREEN 0, 0, 1, 1
  28.     CALL qbideOrig
  29.  
  30.     SCREEN 0, 0, 2, 0
  31.     CALL qbide
  32.  
  33.     SCREEN 0, 0, 1, 1
  34.     _DELAY 2
  35.  
  36.     IF _FILEEXISTS("Thunder6.ogg") THEN
  37.         Rain& = _SNDOPEN("RainBk.ogg", "SYNC")
  38.         T1& = _SNDOPEN("Thunder1.ogg", "SYNC")
  39.         T2& = _SNDOPEN("Thunder2.ogg", "SYNC")
  40.         T3& = _SNDOPEN("Thunder3.ogg", "SYNC")
  41.         T4& = _SNDOPEN("Thunder4.ogg", "SYNC")
  42.         T5& = _SNDOPEN("Thunder5.ogg", "SYNC")
  43.         T6& = _SNDOPEN("Thunder6.ogg", "SYNC")
  44.         T7& = _SNDOPEN("Thunder7.ogg", "SYNC")
  45.         T8& = _SNDOPEN("Thunder8.ogg", "SYNC")
  46.  
  47.         _SNDPLAY T6&
  48.         _DELAY .1
  49.         _SNDPLAY T7&
  50.         _DELAY .1
  51.         _SNDPLAY T8&
  52.     ELSE
  53.         SOUND 1000, .3: SOUND 2400, .6:: SOUND 700, 2
  54.     END IF
  55.  
  56.     FOR i = 1 TO 15
  57.         _DELAY i / 150
  58.         IF i / 2 = i \ 2 THEN
  59.             SOUND 250, .1
  60.             SCREEN 0, 0, 1, 1
  61.         ELSE
  62.             SCREEN 0, 0, 2, 2
  63.             IF i < 13 THEN _DELAY i / 100: SCREEN 0, 0, 3, 3: COLOR 0, 7: CLS
  64.         END IF
  65.     NEXT
  66.  
  67.     PCOPY 2, 0
  68.     SCREEN 0, 0, 0, 0
  69.     _DELAY 1
  70.  
  71.     CALL TheBOB
  72.  
  73.     CALL qbide
  74.  
  75.     CALL qbide
  76.  
  77. IF intro% = -1 THEN RESTORE first_play ELSE RESTORE replay
  78.  
  79. CALL instructions
  80.  
  81.     IF inextrnd = -1 THEN PCOPY 3, 0
  82.     tank$ = CHR$(218) + CHR$(127) + CHR$(191): icolor = 6
  83.     REDIM SHARED bullet%(5), bulletcol%(5), bulletdelay%(5), iltalien(imaxalienforce)
  84.     REDIM SHARED ia(imaxalienmissiles), iy(imaxalienmissiles), ix(imaxalienmissiles)
  85.     REDIM SHARED matrix(imaxalienforce) AS STRING * 10
  86.     alienforce% = imaxalienforce
  87.     level = .65
  88.     iround = iround + 1
  89.     level = level - iround / 15
  90.     inextrnd = -1
  91.     COLOR 6, ibk
  92.  
  93.     REM Set up aliens
  94.     ialiencol = ialiencolstat
  95.     LOCATE 2, ialiencol
  96.     FOR i = 1 TO imaxalienforce
  97.         IF i MOD 1 = 0 THEN PRINT
  98.         LOCATE , ialiencol
  99.         IF i = imaxalienforce THEN ileadingrow = CSRLIN: ileadingmax = ileadingrow
  100.         a(i) = a$
  101.         PRINT a(i)
  102.     NEXT
  103.  
  104.     COLOR 0 + 16, 3
  105.     LOCATE 25, 68: PRINT "Score ";
  106.     COLOR 0, 3
  107.     PRINT score$;
  108.     COLOR 6, ibk
  109.  
  110.     REM Station
  111.     LOCATE 24, 40
  112.     tanky% = CSRLIN: tankx% = POS(0) + 1
  113.     PRINT tank$;: LOCATE , POS(0) - 2
  114.  
  115.     _DELAY 1
  116.  
  117.     DO
  118.         z1 = TIMER
  119.         DO
  120.             IF zbonus THEN
  121.                 IF ABS(zbonus - TIMER) > 1.5 THEN
  122.                     yy% = CSRLIN: xx% = POS(0)
  123.                     COLOR 6, 0: LOCATE topmargin%, lmargin%: PRINT SPACE$(screenwidth%);
  124.                     LOCATE yy%, xx%
  125.                     zbonus = 0
  126.                 END IF
  127.             END IF
  128.  
  129.             IF topmargin% + ileadingmax - (imaxalienforce * 2) >= topmargin% + 2 THEN
  130.                 IF imothership <> 0 THEN CALL mship(imothership)
  131.             END IF
  132.             IF ABS(TIMER - z1aliens) > level THEN
  133.                 CALL movealiens(ialiencol, ialiencolstat, iresults)
  134.                 z1aliens = TIMER
  135.             END IF
  136.             IF iresults < 0 THEN EXIT DO
  137.             IF ABS(TIMER - z1ia) > .3 THEN CALL alienmissile(iresults): z1ia = TIMER
  138.  
  139.             DEF SEG = 0
  140.             IF PEEK(1047) MOD 16 = 7 OR PEEK(1047) MOD 16 = 8 THEN
  141.                 key$ = CHR$(32) ' Alt
  142.             ELSE
  143.                 key$ = ""
  144.             END IF
  145.             DEF SEG
  146.  
  147.             SELECT CASE key$
  148.                 CASE CHR$(32)
  149.                     IF flag = 0 THEN switch = switch * -1 - 1: flag = -1
  150.                     SELECT CASE switch
  151.                         CASE 0
  152.                             IF ABS(z9 - TIMER) > .15 THEN
  153.                                 IF POS(0) < screenwidth% THEN COLOR icolor, ibk: LOCATE , POS(0) - 1: PRINT " " + tank$;: LOCATE , POS(0) - 2
  154.                                 tanky% = CSRLIN: tankx% = POS(0)
  155.                                 IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  156.                                 z9 = TIMER
  157.                             END IF
  158.                         CASE -1
  159.                             IF ABS(z9 - TIMER) > .15 THEN
  160.                                 IF POS(0) > lmargin% + 1 THEN COLOR icolor, ibk: LOCATE , POS(0) - 2: PRINT tank$ + " ";: LOCATE , POS(0) - 3
  161.                                 tanky% = CSRLIN: tankx% = POS(0)
  162.                                 IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  163.                                 z9 = TIMER
  164.                             END IF
  165.                     END SELECT
  166.                     IF icolor = 6 THEN
  167.                         FOR i2 = 1 TO 5
  168.                             IF bullet%(i2) = 0 THEN
  169.                                 icolor = 12: COLOR icolor, ibk: GOSUB redraw
  170.                                 bullet%(i2) = -1: reload = TIMER: EXIT FOR
  171.                             END IF
  172.                         NEXT
  173.                     END IF
  174.                 CASE ""
  175.                     IF flag THEN skip = 0: flag = 0
  176.                 CASE CHR$(27): SYSTEM
  177.             END SELECT
  178.  
  179.             IF ABS(z1 - reload) > .6 AND reload <> 0 THEN
  180.                 GOSUB redraw
  181.                 icolor = 6: reload = 0
  182.             END IF
  183.  
  184.             REM Fire
  185.             FOR i = 1 TO 5
  186.                 SELECT CASE bullet%(i)
  187.                     CASE -1: bullet%(i) = tanky% - 1: bulletcol%(i) = tankx%
  188.                     CASE IS > 0
  189.                         IF bulletdelay%(i) = -1 OR bullet%(i) = tanky% - 1 THEN
  190.                             CALL checkcollision(ihitaliens, ialiencol, i4, i)
  191.                             z2bullet = TIMER: bulletdelay%(i) = 0
  192.                             COLOR 6, ibk
  193.                             LOCATE bullet%(i), bulletcol%(i)
  194.                             IF bullet%(i) = topmargin% AND imothership <> 0 THEN ' Hit mother ship.
  195.                                 IF SCREEN(ABS(bullet%(i)), bulletcol%(i)) <> 32 THEN
  196.                                     SOUND 1000, .75
  197.                                     SELECT CASE iresults + 1
  198.                                         CASE 1: bonus = 1500
  199.                                         CASE 2: bonus = 2500
  200.                                         CASE 3: bonus = 5000
  201.                                     END SELECT
  202.                                     score$ = LTRIM$(STR$(VAL(score$) + bonus))
  203.                                     score$ = STRING$(6 - LEN(score$), "0") + score$
  204.                                     yy% = CSRLIN: xx% = POS(0)
  205.                                     SOUND 800, .5: SOUND 1600, .5: SOUND 2400, .5
  206.                                     LOCATE topmargin%, lmargin%: PRINT SPACE$(screenwidth%);
  207.                                     kbonus = bulletcol%(i) - 4
  208.                                     IF kbonus < lmargin% THEN kbonus = lmargin%
  209.                                     IF kbonus + 10 > screenwidth% THEN kbonus = screenwidth% - 11
  210.                                     zbonus = TIMER
  211.                                     LOCATE yy%, xx%
  212.                                     imothership = 0
  213.                                 END IF
  214.                             END IF
  215.                             PRINT CHR$(24) ' Tank missile.
  216.                             IF CSRLIN <> 24 THEN LOCATE , bulletcol%(i): PRINT " ";
  217.                             IF ihitaliens <> 0 THEN CALL reprintaliens(ialiencol, ihitaliens, iresults, i4, i, imothership)
  218.                             LOCATE tanky%, tankx%
  219.                             IF bullet%(i) > topmargin% THEN
  220.                                 bullet%(i) = bullet%(i) - 1
  221.                             ELSE
  222.                                 GOSUB erasebullet
  223.                             END IF
  224.  
  225.                             IF zbonus THEN
  226.                                 yy% = CSRLIN: xx% = POS(0)
  227.                                 LOCATE topmargin%, kbonus: COLOR 2 + 16: PRINT "BONUS " + LTRIM$(STR$(bonus));
  228.                                 LOCATE yy%, xx%
  229.                             END IF
  230.  
  231.                         END IF
  232.                 END SELECT
  233.             NEXT
  234.  
  235.             REM Bullet timer delay
  236.             IF z2bullet <> 0 THEN
  237.                 IF z1 < z2bullet THEN z2bullet = z2bullet - 86400
  238.                 IF z1 - z2bullet >= .06 THEN
  239.                     FOR i2 = 1 TO 5
  240.                         IF bullet%(i2) <> 0 THEN bulletdelay%(i2) = -1
  241.                     NEXT i2
  242.                 END IF
  243.                 EXIT DO
  244.             END IF
  245.         LOOP
  246.         IF iresults < 0 THEN EXIT DO
  247.         IF alienforce% = 0 OR iresults = iwin THEN
  248.             FOR i = 1 TO imaxalienmissiles
  249.                 IF ia(i) <> 0 THEN EXIT FOR
  250.             NEXT
  251.             IF i > imaxalienmissiles THEN iwait = -1
  252.             IF iwait = -1 THEN
  253.                 EXIT DO
  254.             END IF
  255.         ELSE
  256.             iwait = 1
  257.         END IF
  258.     LOOP
  259.  
  260.     IF iresults = iwin OR iresults < 0 THEN
  261.         REM end game
  262.         EXIT DO
  263.     END IF
  264.     inextrnd = -1
  265.  
  266. SELECT CASE iresults
  267.     CASE -1 ' Tank destroyed!
  268.         SOUND 800, .3: SOUND 250, 1
  269.  
  270.         FOR i = 1 TO 5
  271.             COLOR 14, 4
  272.             LOCATE tanky%, tankx% - 1: PRINT tank$;
  273.             _DELAY .1
  274.  
  275.             COLOR 8, ibk
  276.             LOCATE tanky%, tankx% - 1: PRINT tank$;
  277.             _DELAY .1
  278.         NEXT
  279.  
  280.         COLOR 6, ibk
  281.         LOCATE tanky% - 1, lmargin%
  282.         PRINT SPACE$(screenwidth%);
  283.         LOCATE tanky%, lmargin%
  284.         PRINT SPACE$(screenwidth%);
  285.  
  286.         _DELAY 2
  287.  
  288.         CALL qbide
  289.  
  290.     CASE -2 ' Aliens have landed!
  291.         SOUND 1000, .3: SOUND 2400, .6:: SOUND 700, 2
  292.  
  293.         COLOR 7, 0
  294.         FOR i = 0 TO 21 ' Blank out screen.
  295.             LOCATE topmargin% + i, lmargin%: PRINT SPACE$(screenwidth%);
  296.         NEXT
  297.  
  298.         COLOR 6, ibk
  299.         LOCATE tanky% - 1, lmargin%
  300.         PRINT SPACE$(screenwidth%);
  301.         LOCATE tanky%, lmargin%
  302.         PRINT SPACE$(screenwidth%);
  303.  
  304.         COLOR 8, ibk
  305.  
  306.         FOR j = imaxalienforce TO 1 STEP -1
  307.             IF a(j) <> "" THEN EXIT FOR
  308.         NEXT
  309.  
  310.         FOR i = j TO 1 STEP -1
  311.             LOCATE , ialiencol + INSTR(a(i), "^^")
  312.             PRINT LTRIM$(RTRIM$(a(i)));
  313.             LOCATE CSRLIN - 1
  314.         NEXT
  315.  
  316.         _DELAY 2.5
  317.  
  318.     CASE ELSE ' Winner.
  319.  
  320.         l$ = "12"
  321.         n$ = "n29": PLAY "L" + l$ + n$: _DELAY .5
  322.         n$ = "n24": PLAY "L" + l$ + n$: _DELAY .5
  323.         n$ = "n33": PLAY "L" + l$ + n$: _DELAY .5
  324.         n$ = "n29": PLAY "L" + l$ + n$
  325.  
  326.         CALL qbide
  327.  
  328.         RESTORE winner
  329.  
  330.  
  331.  
  332. COLOR 0, 3
  333. LOCATE 25, 68: PRINT "Score "; score$;
  334.  
  335. CALL instructions
  336.  
  337. COLOR 6, 0
  338. LOCATE 5, 3: PRINT "Score "; score$
  339.  
  340. DEF SEG = 0
  341.     _LIMIT 30
  342.     b$ = INKEY$
  343.     IF b$ = CHR$(27) THEN SYSTEM
  344.     IF PEEK(1047) MOD 16 = 7 OR PEEK(1047) MOD 16 = 8 THEN EXIT DO
  345.  
  346. RUN skip_intro
  347.  
  348. erasebullet:
  349. LOCATE ABS(bullet%(i)), bulletcol%(i): PRINT " ";
  350. bullet%(i) = 0: bulletcol%(i) = 0: bulletdelay%(i) = 0
  351. LOCATE tanky%, tankx%
  352.  
  353. redraw:
  354. COLOR , ibk: LOCATE tanky%, tankx% - 1: PRINT tank$;: LOCATE tanky%, tankx%: COLOR 7, ibk
  355.  
  356. first_play:
  357. DATA "The Great Pumpkin has fired an EM pulse at your computer."
  358. DATA ""
  359. DATA "All that's left working is your Alt key."
  360. DATA ""
  361. DATA "Happy Halloween!"
  362. DATA ""
  363. replay:
  364. DATA "Loading..."
  365. DATA "EOF"
  366. DATA "Game Over. Thanks for playing..."
  367. DATA "EOF2"
  368. winner:
  369. DATA "Congratulations, you saved the planet!"
  370. DATA "EOF3"
  371.  
  372.  
  373. SUB alienattack (ialiencol)
  374.     z2alienfire = TIMER
  375.  
  376.     i3 = INT(RND * 10)
  377.     FOR i = 1 TO imaxalienmissiles
  378.         IF ia(i) = 0 THEN
  379.             FOR i2 = imaxalienforce TO 1 STEP -1
  380.                 IF RTRIM$(a(i2)) <> "" THEN
  381.                     IF MID$(matrix(i2), i3 + 1, 1) <> "0" THEN
  382.                         i4 = INSTR(i3 * 7 + 1, a(i2), CHR$(79)) + ialiencol
  383.                         EXIT FOR
  384.                     END IF
  385.                 END IF
  386.             NEXT i2
  387.             IF i4 <> 0 THEN
  388.                 ia(i) = (ileadingmax - (imaxalienforce - i2) * 2) * 80 + i4
  389.                 EXIT FOR
  390.             END IF
  391.         END IF
  392.     NEXT i
  393.  
  394.  
  395. SUB alienmissile (iresults)
  396.     irow = CSRLIN: icol = POS(0)
  397.     FOR i = 1 TO imaxalienmissiles
  398.         IF ia(i) <> 0 THEN
  399.             IF iy(i) = 0 THEN
  400.                 iy(i) = ia(i) \ 80: ix(i) = ia(i) MOD 80
  401.                 IF ix(i) = 0 THEN ix(i) = screenwidth%
  402.             END IF
  403.             LOCATE iy(i) + 1, ix(i)
  404.             COLOR 6, ibk
  405.             IF CSRLIN <= 24 THEN
  406.                 IF CSRLIN = 24 THEN IF SCREEN(CSRLIN, ix(i)) <> 32 THEN iresults = -1
  407.                 PRINT CHR$(25);
  408.             ELSE
  409.                 ia(i) = 0
  410.                 LOCATE iy(i), ix(i)
  411.                 PRINT " ";: iy(i) = 0
  412.                 ia(i) = 0
  413.                 LOCATE irow, icol
  414.                 EXIT SUB
  415.             END IF
  416.             LOCATE iy(i), ix(i): PRINT " ";
  417.             iy(i) = iy(i) + 1
  418.         END IF
  419.     NEXT
  420.     LOCATE irow, icol
  421.  
  422.  
  423. SUB checkcollision (ihitaliens, ialiencol, i4, i)
  424.     ihitaliens = 0
  425.     IF ileadingmax MOD 2 = bullet%(i) MOD 2 THEN
  426.         i4 = imaxalienforce - (ileadingmax - bullet%(i)) \ 2
  427.         IF bullet%(i) <= ileadingrow AND i4 > 0 AND i4 <= imaxalienforce THEN
  428.             IF RTRIM$(a(i4)) <> "" THEN
  429.                 IF bulletcol%(i) >= iltalien(i4) AND bulletcol%(i) - ialiencol <= LEN(RTRIM$(a(i4))) THEN
  430.                     IF MID$(a(i4), bulletcol%(i) - ialiencol, 1) > CHR$(32) THEN
  431.                         ihitaliens = bulletcol%(i) - ialiencol + 1
  432.                         i3 = ihitaliens - 7 + 1: IF i3 < 1 THEN i3 = 1: REM count from the "<" symbol.
  433.                         i2 = INSTR(i3 + 1, a(i4), "^" + CHR$(79)) - 1
  434.                         MID$(a(i4), i2, 7) = SPACE$(7)
  435.                         MID$(matrix(i4), (i2 + 1) \ 7 + 1, 1) = "0"
  436.                     END IF
  437.                 END IF
  438.             END IF
  439.         END IF
  440.     END IF
  441.  
  442.     FOR i2 = 1 TO imaxalienmissiles
  443.         IF ia(i2) <> 0 THEN
  444.             IF iy(i2) >= bullet%(i) AND ix(i2) = bulletcol%(i) THEN
  445.                 ihitaliens = -i2
  446.                 EXIT FOR
  447.             END IF
  448.         END IF
  449.     NEXT
  450.  
  451.  
  452. SUB instructions
  453.     IF in$ = "" THEN
  454.         key$ = INKEY$
  455.         LOCATE 3, 3, 1, 7, 0: COLOR 6, ibk
  456.         _DELAY 2
  457.         DO
  458.             READ in$
  459.             IF MID$(in$, 1, 3) = "EOF" THEN EXIT DO
  460.             FOR i = 1 TO LEN(in$)
  461.                 SOUND 400, .07
  462.                 LOCATE , 2 + i
  463.                 PRINT MID$(in$, i, 1);
  464.                 z = TIMER
  465.                 DO
  466.                     IF ABS(z - TIMER) > .08 THEN EXIT DO
  467.                 LOOP
  468.             NEXT
  469.             LOCATE , , 0, 7, 0
  470.             _DELAY 1
  471.             PRINT
  472.             LOCATE , 3
  473.         LOOP
  474.         _DELAY 1
  475.     END IF
  476.  
  477.     IF in$ = "EOF" THEN
  478.         COLOR 7, 0
  479.         FOR i = 0 TO 19 ' Blank out intro message space.
  480.             LOCATE topmargin% + i, lmargin%: PRINT SPACE$(screenwidth%);
  481.         NEXT
  482.         FOR i = 3 TO 24
  483.             LOCATE i, 80: PRINT CHR$(179);
  484.         NEXT
  485.         LOCATE 21, 2: PRINT STRING$(screenwidth%, " ");
  486.         LOCATE 22, 1: PRINT CHR$(179);
  487.         LOCATE 22, 80: PRINT CHR$(179);
  488.         LOCATE 22, 2: PRINT STRING$(screenwidth%, " ");
  489.     ELSE
  490.         COLOR 0, 3
  491.     END IF
  492.  
  493.     IF in$ <> "EOF2" AND iresults <> iwin THEN COLOR 0 + 16, 3 ELSE COLOR 0, 3
  494.     yy% = CSRLIN: xx% = POS(0)
  495.     LOCATE 25, 68: PRINT "Score ";
  496.     COLOR 0, 3
  497.     PRINT score$;
  498.     LOCATE yy%, xx%
  499.  
  500.     PCOPY 0, 3: REM save skin
  501.  
  502.  
  503. SUB marchdown (ialiencol, ialiencolstat, imotion, iresults)
  504.     COLOR 6, ibk
  505.     ileadingrow = ileadingrow + 1
  506.     ileadingmax = ileadingmax + 1
  507.     COLOR 6, ibk
  508.     FOR i = 1 TO imaxalienforce
  509.         REM SOUND 400, .2 ' Level down.
  510.         IF RTRIM$(a(i)) <> "" THEN
  511.             ialiencol = ialiencolstat + imotion
  512.             LOCATE ileadingmax - (imaxalienforce * 2) + i * 2 - 1, lmargin%
  513.             PRINT STRING$(screenwidth%, " ")
  514.             LOCATE , ialiencol + INSTR(a(i), "^^")
  515.             iltalien(i) = POS(0)
  516.             PRINT LTRIM$(RTRIM$(a(i)))
  517.         END IF
  518.     NEXT
  519.     LOCATE irow, icol
  520.     level = level - .025
  521.     IF ileadingrow = 22 THEN iresults = -2 ' Aliens have landed!
  522.  
  523. SUB movealiens (ialiencol, ialiencolstat, iresults)
  524.     STATIC imotion, imarch, imotiondir
  525.  
  526.     SOUND 800, .1: SOUND 200, .33 ' Marching sound.
  527.  
  528.     IF inextrnd = -1 THEN inextrnd = 0: imotion = 0: imarch = 0: imotiondir = 0
  529.     irow = CSRLIN: icol = POS(0)
  530.     yy% = CSRLIN: xx% = POS(0)
  531.     PCOPY 0, 1: SCREEN 0, 0, 1, 0: LOCATE yy%, xx%, 0, 7, 0
  532.     IF imotiondir = 0 THEN imotion = imotion - 1 ELSE imotion = imotion + 1
  533.     COLOR 6, ibk
  534.  
  535.     FOR i = imaxalienforce TO 1 STEP -1
  536.         IF RTRIM$(a(i)) <> "" THEN
  537.             i2 = i2 + 2
  538.             ialiencol = ialiencolstat + imotion
  539.             LOCATE ileadingmax - (imaxalienforce - i) * 2, ialiencol + INSTR(a(i), "^^")
  540.             IF POS(0) = lmargin% THEN imarch = 1
  541.             iltalien(i) = POS(0)
  542.             IF imotiondir = 0 THEN
  543.                 PRINT LTRIM$(RTRIM$(a(i))); " "
  544.             ELSE
  545.                 LOCATE , POS(0) - 1
  546.                 PRINT " "; LTRIM$(RTRIM$(a(i)))
  547.             END IF
  548.             IF ialiencol + LEN(RTRIM$(a(i))) = screenwidth% THEN imarch = -1
  549.         END IF
  550.     NEXT
  551.  
  552.     IF imarch = 1 THEN imotiondir = 1: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  553.     IF imarch = -1 THEN imotiondir = 0: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  554.     IF imarch = 0 THEN
  555.         IF ABS(TIMER - z2alienfire) > firerate THEN
  556.             firerate = (INT(RND * 10) + 1) / 20
  557.             IF iwait = 0 THEN CALL alienattack(ialiencol)
  558.         END IF
  559.     ELSE
  560.         imarch = 0
  561.     END IF
  562.     PCOPY 1, 0: SCREEN 0, 0, 0, 0
  563.     LOCATE irow, icol, 1, 7, 0
  564.  
  565. SUB mship (imothership)
  566.     STATIC x%, mov%, z4, mothership$
  567.  
  568.     yy% = CSRLIN: xx% = POS(0): COLOR 6, ibk
  569.     IF imothership = -1 THEN
  570.         imothership = 1
  571.         x% = lmargin%
  572.         mothership$ = CHR$(254) + CHR$(254) + "O" + CHR$(254) + CHR$(254)
  573.         mov% = 1
  574.     END IF
  575.  
  576.     IF ABS(TIMER - z4) > .05 THEN GOSUB mothership: z4 = TIMER: LOCATE yy%, xx%: EXIT SUB
  577.     LOCATE yy%, xx%
  578.     EXIT SUB
  579.  
  580.     mothership:
  581.     IF x% + LEN(mothership$) = screenwidth% + lmargin% THEN mov% = -1 ELSE IF x% = lmargin% THEN mov% = 1
  582.     x% = x% + mov%
  583.     LOCATE topmargin%, x%
  584.     PRINT mothership$;
  585.     IF x% > 1 AND mov% = 1 THEN
  586.         LOCATE , POS(0) - LEN(mothership$) - 1: PRINT " ";
  587.     END IF
  588.     IF mov% = -1 THEN PRINT " ";
  589.     RETURN
  590.  
  591.  
  592. DEFINT A-H, J-Z
  593. SUB qbide
  594.     PALETTE 2, 59
  595.     COLOR 15, 0
  596.     CLS
  597.  
  598.     COLOR 0, 7
  599.     LOCATE 1, 1
  600.     PRINT SPACE$(80)
  601.     LOCATE 1, 1: PRINT "   File  Edit  View  Search  Run  Debug  Calls  Options                   Help"
  602.  
  603.     COLOR 7, 0 ' Black background.
  604.  
  605.     LOCATE 2, 1: PRINT CHR$(218)
  606.     LOCATE 2, 2: PRINT STRING$(78, CHR$(196))
  607.     LOCATE 2, 80: PRINT CHR$(191)
  608.  
  609.     LOCATE 2, 76: PRINT CHR$(180)
  610.     LOCATE 2, 78: PRINT CHR$(195)
  611.  
  612.     COLOR 0, 7
  613.     LOCATE 2, 77: PRINT CHR$(24)
  614.     LOCATE 2, 36: PRINT " Untitled "
  615.  
  616.     COLOR 7, 0
  617.     FOR Rows = 3 TO 24
  618.         LOCATE Rows, 1: PRINT CHR$(179);
  619.         LOCATE Rows, 80: PRINT CHR$(179);
  620.     NEXT Rows
  621.  
  622.     LOCATE 22, 1: PRINT CHR$(195)
  623.     LOCATE 22, 80: PRINT CHR$(180)
  624.     LOCATE 22, 2: PRINT STRING$(78, CHR$(196))
  625.     LOCATE 22, 35
  626.     PRINT " Immediate "
  627.  
  628.     COLOR 0, 7
  629.     LOCATE 21, 3: PRINT STRING$(76, CHR$(176))
  630.     LOCATE 21, 2: PRINT CHR$(27)
  631.     LOCATE 21, 3: PRINT CHR$(219)
  632.     LOCATE 21, 79: PRINT CHR$(26)
  633.     FOR Rows = 4 TO 19
  634.         LOCATE Rows, 80: PRINT CHR$(176)
  635.     NEXT Rows
  636.     LOCATE 3, 80: PRINT CHR$(24)
  637.     LOCATE 4, 80: PRINT CHR$(219)
  638.     LOCATE 20, 80: PRINT CHR$(25)
  639.  
  640.     COLOR 0, 3: LOCATE 25, 1: PRINT " <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step> ";
  641.     LOCATE 25, 59: PRINT SPACE$(4);
  642.     COLOR 0, 3
  643.     LOCATE 25, 63: PRINT CHR$(179);
  644.     LOCATE 25, 64: PRINT SPACE$(6);
  645.     LOCATE 25, 68: PRINT "C  00001:001 ";
  646.  
  647.  
  648. DEFSNG A-H, J-Z
  649. SUB reprintaliens (ialiencol, ihitaliens, iresults, i4, i, imothership)
  650.     IF ihitaliens > 0 THEN
  651.         ihits = ihits + 1
  652.  
  653.         SELECT CASE iresults + 1
  654.             CASE 1: score$ = LTRIM$(STR$(VAL(score$) + 150))
  655.             CASE 2: score$ = LTRIM$(STR$(VAL(score$) + 250))
  656.             CASE 3: score$ = LTRIM$(STR$(VAL(score$) + 350))
  657.         END SELECT
  658.  
  659.         score$ = STRING$(6 - LEN(score$), "0") + score$
  660.         IF (ihits + 15) MOD 20 = 0 AND imothership = 0 THEN imothership = -1
  661.         LOCATE bullet%(i), lmargin%: PRINT SPACE$(screenwidth%);
  662.         iltalien(i4) = POS(0)
  663.  
  664.         IF RTRIM$(a(i4)) = "" THEN
  665.             alienforce% = alienforce% - 1
  666.             IF alienforce% = 0 THEN iresults = iresults + 1 ' Level completed. Goto to next level.
  667.             IF bullet%(i) = ileadingrow THEN ileadingrow = ileadingrow - 2
  668.         ELSE
  669.             LOCATE bullet%(i), ialiencol + INSTR(a(i4), "^^"): PRINT LTRIM$(RTRIM$(a(i4)))
  670.         END IF
  671.     ELSE
  672.         i2 = ABS(ihitaliens)
  673.         LOCATE iy(i2), ix(i2)
  674.         PRINT " ";: iy(i2) = 0
  675.         ia(i2) = 0
  676.         LOCATE irow, icol
  677.         SOUND 1000, .5
  678.     END IF
  679.  
  680.     ihitaliens = 0
  681.     bullet%(i) = -bullet%(i)
  682.  
  683.     COLOR 0, 3
  684.     yy% = CSRLIN: xx% = POS(0)
  685.     LOCATE 25, 74: PRINT score$;
  686.     LOCATE yy%, xx%
  687.     COLOR 6, ibk
  688.  
  689.  
  690. SUB qbideOrig
  691.     PALETTE 2, 59
  692.     COLOR 15, 1
  693.     CLS
  694.  
  695.     COLOR 0, 7
  696.     LOCATE 1, 1
  697.     PRINT SPACE$(80)
  698.     LOCATE 1, 1: PRINT "   File  Edit  View  Search  Run  Debug  Calls  Options                   Help"
  699.  
  700.     COLOR 7, 1
  701.  
  702.     LOCATE 2, 1: PRINT CHR$(218)
  703.     LOCATE 2, 2: PRINT STRING$(78, CHR$(196))
  704.     LOCATE 2, 80: PRINT CHR$(191)
  705.  
  706.     LOCATE 2, 76: PRINT CHR$(180)
  707.     LOCATE 2, 78: PRINT CHR$(195)
  708.  
  709.     COLOR 1, 7
  710.     LOCATE 2, 77: PRINT CHR$(24)
  711.     LOCATE 2, 36: PRINT " Untitled "
  712.  
  713.     COLOR 7, 1
  714.     FOR Rows = 3 TO 24
  715.         LOCATE Rows, 1: PRINT CHR$(179);
  716.         LOCATE Rows, 80: PRINT CHR$(179);
  717.     NEXT Rows
  718.  
  719.     LOCATE 22, 1: PRINT CHR$(195)
  720.     LOCATE 22, 80: PRINT CHR$(180)
  721.     LOCATE 22, 2: PRINT STRING$(78, CHR$(196))
  722.     LOCATE 22, 35
  723.     PRINT " Immediate "
  724.  
  725.     COLOR 0, 7
  726.     LOCATE 21, 3: PRINT STRING$(76, CHR$(176))
  727.     LOCATE 21, 2: PRINT CHR$(27)
  728.     LOCATE 21, 3: PRINT CHR$(219)
  729.     LOCATE 21, 79: PRINT CHR$(26)
  730.     FOR Rows = 4 TO 19
  731.         LOCATE Rows, 80: PRINT CHR$(176)
  732.     NEXT Rows
  733.     LOCATE 3, 80: PRINT CHR$(24)
  734.     LOCATE 4, 80: PRINT CHR$(219)
  735.     LOCATE 20, 80: PRINT CHR$(25)
  736.  
  737.     COLOR 0, 3: LOCATE 25, 1: PRINT " <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step> ";
  738.     LOCATE 25, 59: PRINT SPACE$(4);
  739.     COLOR 0, 3
  740.     LOCATE 25, 63: PRINT CHR$(179);
  741.     LOCATE 25, 64: PRINT SPACE$(6);
  742.     LOCATE 25, 68: PRINT "C  00001:001 ";
  743.  
  744.  
  745. SUB TheBOB
  746.    ' This sub routine created by Bob Seguin of the QBasic Forum.
  747.    SCREEN 12
  748.  
  749.     OUT &H3C8, 1: OUT &H3C9, 40: OUT &H3C9, 12: OUT &H3C9, 0
  750.     OUT &H3C8, 2: OUT &H3C9, 6: OUT &H3C9, 12: OUT &H3C9, 0
  751.     OUT &H3C8, 3: OUT &H3C9, 30: OUT &H3C9, 8: OUT &H3C9, 0
  752.     OUT &H3C8, 4: OUT &H3C9, 3: OUT &H3C9, 8: OUT &H3C9, 0
  753.     OUT &H3C8, 7: OUT &H3C9, 63: OUT &H3C9, 0: OUT &H3C9, 0
  754.     OUT &H3C8, 8: OUT &H3C9, 46: OUT &H3C9, 0: OUT &H3C9, 0
  755.     OUT &H3C8, 9: OUT &H3C9, 63: OUT &H3C9, 63: OUT &H3C9, 63
  756.     OUT &H3C8, 12: OUT &H3C9, 20: OUT &H3C9, 20: OUT &H3C9, 20
  757.     OUT &H3C8, 13: OUT &H3C9, 0: OUT &H3C9, 0: OUT &H3C9, 0
  758.     OUT &H3C8, 14: OUT &H3C9, 55: OUT &H3C9, 35: OUT &H3C9, 0
  759.  
  760.     CIRCLE (320, 240), 100, 3, , , .9
  761.     PAINT (320, 240), 3
  762.     CIRCLE (320, 230), 90, 1, , , .9
  763.     PAINT (320, 230), 1
  764.     FOR Reps = 1 TO 4
  765.         SELECT CASE Reps
  766.             DATA 1,1.2,1.8,5
  767.             CASE 1: Elipse = 1
  768.             CASE 2: Elipse = 1.2
  769.             CASE 3: Elipse = 1.8
  770.             CASE 4: Elipse = 5
  771.         END SELECT
  772.         FOR E = Elipse TO Elipse + .1 STEP .01
  773.             CIRCLE (320, 240), 100, 3, , , E
  774.         NEXT E
  775.     NEXT Reps
  776.     FOR Radius = 38 TO 43
  777.         CIRCLE (320, 160), Radius, 3, , , .4
  778.     NEXT Radius
  779.     CIRCLE (320, 160), 40, 14, 3.3, 6, .4
  780.     CIRCLE (320, 240), 100, 5, , , .9
  781.     PAINT (0, 0), 5
  782.     CIRCLE (320, 240), 100, 0, , , .9
  783.     PAINT (0, 0), 0
  784.     FOR Radius = 12 TO 18
  785.         CIRCLE (320, 153), Radius, 2, , , .3
  786.     NEXT Radius
  787.     CIRCLE (320, 150), 12, 2, , , .6
  788.     PAINT STEP(0, 0), 2
  789.     CIRCLE (300, 143), 32, 2, 6, 1.1
  790.     CIRCLE (276, 143), 32, 2, 6, .6
  791.     DRAW "BM302,125 C2 M+15,-10 BD10 P2,2"
  792.     PAINT (320, 145), 2
  793.     CIRCLE (282, 143), 32, 4, 6, .73
  794.     CIRCLE (266, 156), 60, 4, .1, .68
  795.     CIRCLE (320, 150), 12, 4, 3.14159, 0, .2
  796.     DRAW "BM302,125 C4 M+15,-10 BD10"
  797.     CIRCLE (276, 143), 32, 4, 6, .6
  798.     PAINT STEP(35, 0), 4
  799.     'Face begins
  800.     CIRCLE (303, 316), 100, 14, 1.5, 2
  801.     CIRCLE (337, 316), 100, 14, 1.1, 1.64
  802.     PSET (310, 215), 14
  803.     DRAW "H30 M-20,+40 M+12,-4 M+14,-29 BL2 P14,14 BF12 P15,14"
  804.     PSET (330, 215), 14
  805.     DRAW "E30 M+20,+40 M-12,-4 M-14,-29 BR2 P14,14 BG12 P15,14"
  806.     PSET (320, 246), 14
  807.     DRAW "R20 H20 G20 R20 U nL19 nR19 BU2 P15,14"
  808.     CIRCLE (320, 170), 100, 14, 3.8, 4.1
  809.     CIRCLE (320, 170), 100, 14, 4.42, 5.01
  810.     CIRCLE (320, 170), 100, 14, 5.33, 5.62
  811.     CIRCLE (320, 220), 80, 14, 3.29, 4.5
  812.     CIRCLE (320, 220), 80, 14, 4.66, 6.15
  813.     PSET (260, 250), 14
  814.     DRAW "D10 F8 U13 M+10,+5 D12 M+12,+6 U12 BR60"
  815.     DRAW "D12 M+12,-6 U12 M+10,-5 D13 E8 U10"
  816.     PSET (300, 297), 14
  817.     DRAW "U14 R16 D16"
  818.     CIRCLE (320, 212), 80, 14, 3.42, 4.5
  819.     CIRCLE (320, 212), 80, 14, 4.66, 6
  820.     LINE (300, 280)-(316, 283), 14, BF
  821.     PAINT (320, 296), 14
  822.     PAINT (290, 292), 14
  823.     PAINT (300, 278), 15, 14
  824.     CIRCLE (100, 240), 32, 13
  825.     PAINT STEP(0, 0), 13
  826.     FOR x% = 58 TO 142
  827.         FOR y% = 198 TO 282
  828.             IF POINT(x%, y%) = 13 THEN
  829.                 IF POINT(x% + 220, y%) = 15 THEN PSET (x% + 220, y%), 9
  830.             END IF
  831.         NEXT y%
  832.     NEXT x%
  833.  
  834.     COLOR 13: LOCATE 1, 1: PRINT "HAPPY HALLOWEEN!"
  835.     xx = 64: yy = 360
  836.     FOR x% = 0 TO 300
  837.         FOR y% = 0 TO 16
  838.             IF POINT(x%, y%) = 13 THEN
  839.                 IF y% > 6 THEN Colr = 8 ELSE Colr = 7
  840.                 LINE (x% * 4 + xx, y% * 4 + yy)-(x% * 4 + xx + 3, y% * 4 + yy + 3), Colr, BF
  841.             END IF
  842.         NEXT y%
  843.     NEXT x%
  844.     FOR x% = 0 TO 639
  845.         IF POINT(x%, 368) <> 0 THEN PSET (x%, 368), 14
  846.     NEXT x%
  847.     LINE (5, 5)-(634, 474), 12, B
  848.     LINE (8, 8)-(631, 471), 12, B
  849.     LINE (50, 354)-(580, 420), 15, B
  850.  
  851.     z1 = TIMER
  852.     DO UNTIL ABS(TIMER - z1) > 4
  853.         FOR Reps = 1 TO 3
  854.             WAIT &H3DA, 8
  855.             WAIT &H3DA, 8, 8
  856.         NEXT Reps
  857.  
  858.         Flicker = FIX(RND * 20)
  859.         OUT &H3C8, 14
  860.         OUT &H3C9, 40 + Flicker
  861.         OUT &H3C9, 25 + Flicker
  862.         OUT &H3C9, 10 + Flicker
  863.  
  864.         OUT &H3C8, 15
  865.         OUT &H3C9, 43 + Flicker
  866.         OUT &H3C9, 38 + Flicker
  867.         OUT &H3C9, 20 + Flicker
  868.     LOOP
  869.     SCREEN 0, 0, 0, 0

 [ You are not allowed to view this attachment ]

Pete
« Last Edit: October 08, 2021, 11:17:03 pm by 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: Competition
« Reply #71 on: October 08, 2021, 11:33:18 pm »
@Pete Great (Pumpkin) Opening!

24750 is a level and almost the 2nd. Was it Black and Red before? good choice.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Competition
« Reply #72 on: October 09, 2021, 12:48:52 am »
Pete,

My apologies for my shameless display of ebullience. You are correct. Quite out of order.

J
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Competition
« Reply #73 on: October 09, 2021, 01:32:55 am »
@johnno56 Did you see this thread from this link to page 2? https://www.qb64.org/forum/index.php?topic=4243.msg136169#msg136169

That's the one that also lead to my Elton John song parody. Quite logical!

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

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Competition
« Reply #74 on: October 09, 2021, 03:26:16 am »
Pete,

My apologies for my shameless display of ebullience. You are correct. Quite out of order.

J

E-bullies are NOT nice!  No matter what you and your auto-correct might say. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!