Author Topic: Tutorials etc  (Read 5371 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Tutorials etc
« on: May 28, 2018, 10:09:33 pm »
Can I encourage the Administrator to add a sub forum dedicated to those of us that are 'still learning'?

I have seen some of the 'sample programs', and yes I can learn stuff by picking them apart, but just posting the program or picking it apart, will not tell me 'how and why' it works. If not a forum, then perhaps, a collection of links that other users can recommend.

In the meantime there are a lot of posts on this site to read... cool.

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tutorials etc
« Reply #1 on: May 29, 2018, 09:15:29 am »
Hi Johnno,

I think some people have been impressed with Terrie Richie's lessons:
http://qb64sourcecode.com

Does anyone know if last 4 Tasks have been finished? (They look to be most interesting.)

I don't know how up-to-date it is. I do know QB64 went through a SDL phase before going with Open GL, so watch out for that.

Johnno do you have a model tutorial in mind, SDL, Naalaa, Basic256... we could link to see what you are looking for in QB64 version? When I say model, I mean one you've followed carefully, worked through and learned from.
« Last Edit: May 29, 2018, 09:24:33 am by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Tutorials etc
« Reply #2 on: May 29, 2018, 05:29:51 pm »
Nothing really specific. Since the advent of Basic, the number of reserved words (commands, functions, whatever they are called), have increased in number greatly. I know I could probably work my way through the "Help Index" but I've done before learning Locomotive Basic for the Amstrad. THAT took a LONG time to learn that way.... There were no Forums; No clubs; No help. Just my User's Manual. There are way more years behind me than ahead, so learning 'alphabetically' like that again, will use more time than I can afford.... *sigh*

My Grandkids like games. Mario-style and anything that blows stuff up. So perhaps endless side scrollers; Space shooters (Space Invaders; Galaxians etc). They are starting to learn Scratch and will hopefully, one day, lead them to making their own stuff. Yeah. So fun, no real thinking required, games would be the shot.

Tutorials about making games would be ideal. Similar to petesqbsite.com (http://petesqbsite.com/sections/tutorials/gamedesign.shtml) but geared for QB64... Stuff like that... (apologies to Admin for including the link - had no other way to explain it...)

No pressure, eh? lol

J
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Tutorials etc
« Reply #3 on: May 29, 2018, 09:27:30 pm »
I made this as a joke when Galleon was taking time away from the compiler to make the QB64 IDE. The IDE opens and Galleon is typing some notes to the screen. It's a bit like you had to be there to get it, when QB64 started in 2008. You know, when you were still just a kid. :D

Note: It worked better in QB45 (QuickBasic) and earlier versions of QB64 (SDL). The mouse can be used to move the gun and fire (tap or left click). The arrow keys seem non-responsive and I haven't spent time on looking into why. So, this is just for fun, since you mentioned Space Invaders.

Pete

Code: QB64: [Select]
  1. DECLARE SUB instructions ()
  2. DECLARE SUB qbide ()
  3. DECLARE SUB mship (imothership)
  4. REM Adds multiple bullets (5) max.
  5. REM Adds firing delay and ship turns red while reloading.
  6. REM Adds aliens.
  7. REM Adds collision for bullets from base to aliens.
  8. REM Adds Mouse support.
  9. REM Adds alien motion.
  10. REM Adds 3 progressive levels.
  11. REM Adds aliens move all the way to both sides.
  12. REM Adds Aliens shoot back.
  13. REM Adds sub-routines.
  14. REM Adds counter.
  15. REM Adds alien bullets finish before moving on to next level.
  16. REM Adds mothership.
  17.  
  18. DECLARE SUB alienattack (ialiencolstat, ialiencol)
  19. DECLARE SUB alienmissile (iresults)
  20. DECLARE SUB checkcollision (ihitaliens, ialiencol, i4, i)
  21. DECLARE SUB mdriver (ex%, key$, tankx%)
  22. DECLARE SUB marchdown (ialiencol, ialiencolstat, imotion, iresults)
  23. DECLARE SUB movealiens (ialiencol, ialiencolstat, iresults)
  24. DECLARE SUB reprintaliens (ialiencol, ihitaliens, iresults, i4, i, imothership)
  25.  
  26. TYPE RegType
  27.     AX AS INTEGER
  28.     BX AS INTEGER
  29.     CX AS INTEGER
  30.     DX AS INTEGER
  31.     BP AS INTEGER
  32.     SI AS INTEGER
  33.     DI AS INTEGER
  34.     FLAGS AS INTEGER
  35.     DS AS INTEGER
  36.     ES AS INTEGER
  37.  
  38. DIM SHARED MOUSE$
  39. DIM SHARED Registers AS RegType
  40. DIM SHARED LB%, RB%, MB%, DX, CX
  41. DIM SHARED lmargin%, rmargin%, topmargin%, screenwidth%, level, ibk, ileadingrow
  42. DIM SHARED irow, icol, inextrnd, imaxalienmissiles, alienforce%, ileadingmax, imaxalienforce, ihits
  43.  
  44. imaxalienforce = 6
  45. imaxalienmissiles = 3
  46. lmargin% = 2
  47. rmargin% = 79
  48. topmargin% = 3
  49. ialiencolstat = 6
  50. iwin = 3
  51. screenwidth% = rmargin% - lmargin% + 1
  52. ibk = 1
  53.  
  54. DIM SHARED a(imaxalienforce) AS STRING * 68
  55.  
  56. SCREEN 0, 0, 0, 0
  57. COLOR 7, 1: CLS
  58.  
  59. REM Make aliens
  60. a1$ = "-<" + CHR$(237) + ">-  "
  61. a$ = a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$ + a1$
  62.  
  63. CALL qbide
  64. CALL instructions
  65.  
  66.     IF inextrnd = -1 THEN PCOPY 3, 0
  67.     tank$ = CHR$(218) + CHR$(127) + CHR$(191): icolor = 7
  68.     REDIM SHARED bullet%(5), bulletcol%(5), bulletdelay%(5), iltalien(imaxalienforce)
  69.     REDIM SHARED ia(imaxalienmissiles), iy(imaxalienmissiles), ix(imaxalienmissiles)
  70.     REDIM SHARED matrix(imaxalienforce) AS STRING * 10
  71.     alienforce% = imaxalienforce
  72.     level = .65
  73.     iround = iround + 1
  74.     level = level - iround / 15
  75.     inextrnd = -1
  76.     COLOR 7, ibk
  77.  
  78.     REM Set up aliens
  79.     ialiencol = ialiencolstat
  80.     LOCATE 2, ialiencol
  81.     FOR i = 1 TO imaxalienforce
  82.         IF i MOD 1 = 0 THEN PRINT
  83.         LOCATE , ialiencol
  84.         IF i = imaxalienforce THEN ileadingrow = CSRLIN: ileadingmax = ileadingrow
  85.         a(i) = a$
  86.         PRINT a(i)
  87.     NEXT
  88.  
  89.     REM Station
  90.     LOCATE 24, 40, 1, 7, 7
  91.     PRINT tank$;: LOCATE , POS(1) - 2: tanky% = CSRLIN: tankx% = POS(1) + 1
  92.     key$ = INKEY$: SLEEP 1
  93.     ex% = 1: CALL mdriver(ex%, key$, tankx%)
  94.     DO
  95.         z1 = TIMER
  96.         DO
  97.             IF topmargin% + ileadingmax - (imaxalienforce * 2) >= topmargin% + 2 THEN
  98.                 IF imothership <> 0 THEN CALL mship(imothership)
  99.             END IF
  100.             IF ABS(TIMER - z1aliens) > level THEN
  101.                 CALL movealiens(ialiencol, ialiencolstat, iresults)
  102.                 z1aliens = TIMER
  103.             END IF
  104.             IF iresults < 0 THEN EXIT DO
  105.             IF ABS(TIMER - z1ia) > .3 THEN CALL alienmissile(iresults): z1ia = TIMER
  106.             key$ = INKEY$
  107.             IF key$ = "" THEN ex% = 2: CALL mdriver(ex%, key$, tankx%)
  108.             SELECT CASE key$
  109.                 CASE CHR$(0) + "K"
  110.                     IF POS(1) > lmargin% + 1 THEN COLOR icolor, ibk: LOCATE , POS(1) - 2: PRINT tank$ + " ";: LOCATE , POS(1) - 3
  111.                     tanky% = CSRLIN: tankx% = POS(1)
  112.                     IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  113.                 CASE CHR$(0) + "M"
  114.                     IF POS(1) < screenwidth% THEN COLOR icolor, ibk: LOCATE , POS(1) - 1: PRINT " " + tank$;: LOCATE , POS(1) - 2
  115.                     tanky% = CSRLIN: tankx% = POS(1)
  116.                     IF SCREEN(tanky%, tankx% - 2) = 25 OR SCREEN(tanky%, tankx% + 2) = 25 THEN result = -1: EXIT DO
  117.                 CASE CHR$(32)
  118.                     IF icolor = 7 THEN
  119.                         FOR i2 = 1 TO 5
  120.                             IF bullet%(i2) = 0 THEN
  121.                                 icolor = 12: COLOR icolor, ibk: GOSUB redraw
  122.                                 bullet%(i2) = -1: reload = TIMER: EXIT FOR
  123.                             END IF
  124.                         NEXT
  125.                     END IF
  126.                 CASE CHR$(27): SYSTEM
  127.             END SELECT
  128.  
  129.             IF ABS(z1 - reload) > .7 AND reload <> 0 THEN
  130.                 GOSUB redraw
  131.                 icolor = 7: reload = 0
  132.             END IF
  133.  
  134.             REM Fire
  135.             FOR i = 1 TO 5
  136.                 SELECT CASE bullet%(i)
  137.                     CASE -1: bullet%(i) = tanky% - 1: bulletcol%(i) = tankx%
  138.                     CASE IS > 0
  139.                         IF bulletdelay%(i) = -1 OR bullet%(i) = tanky% - 1 THEN
  140.                             CALL checkcollision(ihitaliens, ialiencol, i4, i)
  141.                             z2bullet = TIMER: bulletdelay%(i) = 0
  142.                             COLOR 7, ibk
  143.                             LOCATE bullet%(i), bulletcol%(i)
  144.                             IF bullet%(i) = topmargin% AND imothership <> 0 THEN
  145.                                 IF SCREEN(ABS(bullet%(i)), bulletcol%(i)) <> 32 THEN
  146.                                     SOUND 1000, .75
  147.                                     LOCATE topmargin%, lmargin%: PRINT SPACE$(screenwidth%);
  148.                                     imothership = 0
  149.                                 END IF
  150.                             END IF
  151.                             PRINT CHR$(24)
  152.                             IF CSRLIN <> 24 THEN LOCATE , bulletcol%(i): PRINT " ";
  153.                             IF ihitaliens <> 0 THEN CALL reprintaliens(ialiencol, ihitaliens, iresults, i4, i, imothership)
  154.                             LOCATE tanky%, tankx%
  155.                             IF bullet%(i) > topmargin% THEN
  156.                                 bullet%(i) = bullet%(i) - 1
  157.                             ELSE
  158.                                 GOSUB erasebullet
  159.                             END IF
  160.                         END IF
  161.                 END SELECT
  162.             NEXT
  163.  
  164.             REM Bullet timer delay
  165.             IF z2bullet <> 0 THEN
  166.                 IF z1 < z2bullet THEN z2bullet = z2bullet - 86400
  167.                 IF z1 - z2bullet >= .06 THEN
  168.                     FOR i2 = 1 TO 5
  169.                         IF bullet%(i2) <> 0 THEN bulletdelay%(i2) = -1
  170.                     NEXT i2
  171.                 END IF
  172.                 EXIT DO
  173.             END IF
  174.         LOOP
  175.         IF iresults < 0 THEN EXIT DO
  176.         IF alienforce% = 0 OR iresults = iwin THEN
  177.             FOR i = 1 TO imaxalienmissiles
  178.                 IF ia(i) <> 0 THEN EXIT FOR
  179.             NEXT
  180.             IF i > imaxalienmissiles THEN iwait = -1
  181.             IF iwait = -1 THEN
  182.                 EXIT DO
  183.             END IF
  184.         ELSE
  185.             iwait = 1
  186.         END IF
  187.     LOOP
  188.     ex% = -1: CALL mdriver(ex%, key$, tankx%)
  189.     key$ = INKEY$
  190.     SLEEP 2
  191.     IF iresults = iwin OR iresults < 0 THEN
  192.         REM end game
  193.         EXIT DO
  194.     END IF
  195.     inextrnd = -1
  196. SELECT CASE iresults
  197.     CASE IS < 0
  198.         COLOR 7, ibk
  199.         LOCATE tanky% - 1, lmargin%
  200.         PRINT SPACE$(screenwidth%);
  201.         LOCATE tanky%, lmargin%
  202.         PRINT SPACE$(screenwidth%);
  203.         key$ = INKEY$
  204.         SOUND 140, 2
  205.         SLEEP 2
  206. CALL qbide
  207. CALL instructions
  208.  
  209. erasebullet:
  210. LOCATE ABS(bullet%(i)), bulletcol%(i): PRINT " ";
  211. bullet%(i) = 0: bulletcol%(i) = 0: bulletdelay%(i) = 0
  212. LOCATE tanky%, tankx%
  213.  
  214. redraw:
  215. COLOR , ibk: LOCATE tanky%, tankx% - 1: PRINT tank$;: LOCATE tanky%, tankx%: COLOR 7, ibk
  216.  
  217. DATA "Well, I better get busy and finish the compiler..."
  218. DATA "Or... I'll just do some more work on this IDE, instead..."
  219. DATA ""
  220. DATA " Loading..."
  221. DATA "EOF"
  222. DATA "Game Over. Thanks for playing..."
  223. DATA ""
  224. DATA "Now finish the compiler!"
  225. DATA "EOF2"
  226.  
  227. SUB alienattack (ialiencolstat, ialiencol)
  228. z2alienfire = TIMER
  229.  
  230. i3 = INT(RND * 10)
  231. FOR i = 1 TO imaxalienmissiles
  232.     IF ia(i) = 0 THEN
  233.         FOR i2 = imaxalienforce TO 1 STEP -1
  234.             IF RTRIM$(a(i2)) <> "" THEN
  235.                 IF MID$(matrix(i2), i3 + 1, 1) <> "0" THEN
  236.                     i4 = INSTR(i3 * 7 + 1, a(i2), CHR$(237)) + ialiencol
  237.                     EXIT FOR
  238.                 END IF
  239.             END IF
  240.         NEXT i2
  241.         IF i4 <> 0 THEN
  242.             ia(i) = (ileadingmax - (imaxalienforce - i2) * 2) * 80 + i4
  243.             EXIT FOR
  244.         END IF
  245.     END IF
  246.  
  247.  
  248. SUB alienmissile (iresults)
  249. irow = CSRLIN: icol = POS(1)
  250. FOR i = 1 TO imaxalienmissiles
  251.     IF ia(i) <> 0 THEN
  252.         IF iy(i) = 0 THEN
  253.             iy(i) = ia(i) \ 80: ix(i) = ia(i) MOD 80
  254.             IF ix(i) = 0 THEN ix(i) = screenwidth%
  255.         END IF
  256.         LOCATE iy(i) + 1, ix(i)
  257.         COLOR 7, ibk
  258.         IF CSRLIN <= 24 THEN
  259.             IF CSRLIN = 24 THEN IF SCREEN(CSRLIN, ix(i)) <> 32 THEN iresults = -1
  260.             PRINT CHR$(25);
  261.         ELSE
  262.             ia(i) = 0
  263.             LOCATE iy(i), ix(i)
  264.             PRINT " ";: iy(i) = 0
  265.             ia(i) = 0
  266.             LOCATE irow, icol
  267.             EXIT SUB
  268.         END IF
  269.         LOCATE iy(i), ix(i): PRINT " ";
  270.         iy(i) = iy(i) + 1
  271.     END IF
  272. LOCATE irow, icol
  273.  
  274.  
  275. SUB checkcollision (ihitaliens, ialiencol, i4, i)
  276. ihitaliens = 0
  277. IF ileadingmax MOD 2 = bullet%(i) MOD 2 THEN
  278.     i4 = imaxalienforce - (ileadingmax - bullet%(i)) \ 2
  279.     IF bullet%(i) <= ileadingrow AND i4 > 0 AND i4 <= imaxalienforce THEN
  280.         IF RTRIM$(a(i4)) <> "" THEN
  281.             IF bulletcol%(i) >= iltalien(i4) AND bulletcol%(i) - ialiencol <= LEN(RTRIM$(a(i4))) THEN
  282.                 IF MID$(a(i4), bulletcol%(i) - ialiencol, 1) > CHR$(32) THEN
  283.                     ihitaliens = bulletcol%(i) - ialiencol + 1
  284.                     i3 = ihitaliens - 7 + 1: IF i3 < 1 THEN i3 = 1: REM count from the "<" symbol.
  285.                     i2 = INSTR(i3 + 1, a(i4), "<") - 1
  286.                     MID$(a(i4), i2, 7) = SPACE$(7)
  287.                     MID$(matrix(i4), (i2 + 1) \ 7 + 1, 1) = "0"
  288.                 END IF
  289.             END IF
  290.         END IF
  291.     END IF
  292.  
  293. FOR i2 = 1 TO imaxalienmissiles
  294.     IF ia(i2) <> 0 THEN
  295.         IF iy(i2) >= bullet%(i) AND ix(i2) = bulletcol%(i) THEN
  296.             ihitaliens = -i2
  297.             EXIT FOR
  298.         END IF
  299.     END IF
  300.  
  301.  
  302. SUB instructions
  303.  
  304. 'in$ = "EOF"
  305. IF in$ = "" THEN
  306.     key$ = INKEY$
  307.     LOCATE 3, 3, 1, 7, 7: COLOR 7, ibk
  308.     SLEEP 2
  309.     DO
  310.         READ in$
  311.         IF MID$(in$, 1, 3) = "EOF" THEN EXIT DO
  312.         FOR i = 1 TO LEN(in$)
  313.             SOUND 400, .1
  314.             LOCATE , 2 + i
  315.             PRINT MID$(in$, i, 1);
  316.             z = TIMER
  317.             DO
  318.                 IF ABS(z - TIMER) > .1 THEN EXIT DO
  319.             LOOP
  320.         NEXT
  321.         LOCATE , , 0, 7, 0
  322.         key$ = INKEY$
  323.         SLEEP 1
  324.         PRINT
  325.         LOCATE , 3
  326.     LOOP
  327.     key$ = INKEY$
  328.     SLEEP 1
  329.  
  330. IF in$ = "EOF" THEN
  331.     COLOR 7, 1
  332.     FOR i = 1 TO 5
  333.         LOCATE 2 + i, 2: PRINT SPACE$(78)
  334.     NEXT
  335.     FOR i = 3 TO 24
  336.         LOCATE i, 80: PRINT CHR$(179);
  337.     NEXT
  338.     LOCATE 21, 2: PRINT STRING$(78, " ");
  339.     LOCATE 22, 1: PRINT CHR$(179);
  340.     LOCATE 22, 80: PRINT CHR$(179);
  341.     LOCATE 22, 2: PRINT STRING$(78, " ");
  342.     COLOR 0, 3
  343.  
  344. COLOR 0, 3
  345. yy% = CSRLIN: xx% = POS(1)
  346. LOCATE 25, 76 - LEN(LTRIM$(STR$(ihits)))
  347. PRINT LTRIM$(STR$(ihits));
  348. LOCATE 25, 80 - LEN(LTRIM$(STR$(imaxalienforce - alienforce%)))
  349. PRINT "0";
  350. LOCATE yy%, xx%
  351.  
  352. PCOPY 0, 3: REM save skin
  353.  
  354.  
  355. SUB marchdown (ialiencol, ialiencolstat, imotion, iresults)
  356. COLOR 7, ibk
  357. ileadingrow = ileadingrow + 1
  358. ileadingmax = ileadingmax + 1
  359. COLOR 7, ibk
  360. FOR i = 1 TO imaxalienforce
  361.     IF RTRIM$(a(i)) <> "" THEN
  362.         ialiencol = ialiencolstat + imotion
  363.         LOCATE ileadingmax - (imaxalienforce * 2) + i * 2 - 1, lmargin%
  364.         PRINT STRING$(screenwidth%, " ")
  365.         LOCATE , ialiencol + INSTR(a(i), "-")
  366.         iltalien(i) = POS(1)
  367.         PRINT LTRIM$(RTRIM$(a(i)))
  368.     END IF
  369. LOCATE irow, icol
  370. level = level - .025
  371. IF ileadingrow = 22 THEN iresults = -2
  372.  
  373. SUB mdriver (ex%, key$, tankx%)
  374. STATIC MOUSEACT%
  375.  
  376. REM INITIATE MOUSE
  377. IF MOUSEACT% = 0 OR ex% = -1 THEN
  378.     Registers.AX = 0: GOSUB CALLI
  379.     MOUSEACT% = 1
  380.  
  381. IF ex% = 1 THEN
  382.     Registers.AX = 4: Registers.DX = 184: Registers.CX = 304
  383.     Registers.AX = 8: Registers.DX = 184: Registers.CX = 184
  384.     GOSUB CALLI
  385.     EXIT SUB
  386.  
  387. Registers.AX = 3: GOSUB CALLI
  388.  
  389. DX = Registers.DX
  390. CX = Registers.CX
  391. y% = DX \ 8 + 1: x% = CX \ 8 + 1
  392.  
  393. REM MOUSE BUTTONS
  394. LB% = Registers.BX AND 1
  395. RB% = (Registers.BX AND 2) \ 2
  396. MB% = (Registers.BX AND 4) \ 4
  397.  
  398. IF LB% <> 0 THEN
  399.     key$ = CHR$(32)
  400.     IF x% > tankx% THEN key$ = CHR$(0) + "M"
  401.     IF x% < tankx% THEN key$ = CHR$(0) + "K"
  402.  
  403. CALLI:
  404. CALL INTERRUPT(&H33, Registers, Registers)
  405.  
  406.  
  407. SUB movealiens (ialiencol, ialiencolstat, iresults)
  408. STATIC imotion, imarch, imotiondir
  409. IF inextrnd = -1 THEN inextrnd = 0: imotion = 0: imarch = 0: imotiondir = 0
  410. irow = CSRLIN: icol = POS(1)
  411. yy% = CSRLIN: xx% = POS(1)
  412. PCOPY 0, 1: SCREEN 0, 0, 1, 0: LOCATE yy%, xx%, 0, 7, 0
  413. IF imotiondir = 0 THEN imotion = imotion - 1 ELSE imotion = imotion + 1
  414. COLOR 7, ibk
  415.  
  416. FOR i = imaxalienforce TO 1 STEP -1
  417.     IF RTRIM$(a(i)) <> "" THEN
  418.         i2 = i2 + 2
  419.         SOUND 400, .03
  420.         ialiencol = ialiencolstat + imotion
  421.         LOCATE ileadingmax - (imaxalienforce - i) * 2, ialiencol + INSTR(a(i), "-")
  422.         IF POS(1) = lmargin% THEN imarch = 1
  423.         iltalien(i) = POS(1)
  424.         IF imotiondir = 0 THEN
  425.             PRINT LTRIM$(RTRIM$(a(i))); " "
  426.         ELSE
  427.             LOCATE , POS(1) - 1
  428.             PRINT " "; LTRIM$(RTRIM$(a(i)))
  429.         END IF
  430.         IF ialiencol + LEN(RTRIM$(a(i))) = screenwidth% THEN imarch = -1
  431.     END IF
  432.  
  433. IF imarch = 1 THEN imotiondir = 1: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  434. IF imarch = -1 THEN imotiondir = 0: CALL marchdown(ialiencol, ialiencolstat, imotion, iresults)
  435. IF imarch = 0 THEN
  436.     IF ABS(TIMER - z2alienfire) > firerate THEN
  437.         firerate = (INT(RND * 10) + 1) / 20
  438.         IF iwait = 0 THEN CALL alienattack(ialiencolstat, ialiencol)
  439.     END IF
  440.     imarch = 0
  441. PCOPY 1, 0: SCREEN 0, 0, 0, 0
  442. LOCATE irow, icol, 1, 7, 7
  443.  
  444. SUB mship (imothership)
  445. STATIC x%, mov%, z4, mothership$
  446.  
  447. yy% = CSRLIN: xx% = POS(1): COLOR 7, ibk
  448. IF imothership = -1 THEN
  449.     imothership = 1
  450.     x% = lmargin%
  451.     mothership$ = CHR$(254) + CHR$(254) + "O" + CHR$(254) + CHR$(254)
  452.     mov% = 1
  453.  
  454. IF ABS(TIMER - z4) > .05 THEN GOSUB mothership: z4 = TIMER: LOCATE yy%, xx%: EXIT SUB
  455. ''IF ABS(TIMER - z2) > .2 THEN GOSUB bullets: z2 = TIMER
  456. LOCATE yy%, xx%
  457.  
  458. mothership:
  459. IF x% + LEN(mothership$) = screenwidth% + lmargin% THEN mov% = -1 ELSE IF x% = lmargin% THEN mov% = 1
  460. x% = x% + mov%
  461. LOCATE topmargin%, x%
  462. PRINT mothership$;
  463. IF x% > 1 AND mov% = 1 THEN
  464.     LOCATE , POS(1) - LEN(mothership$) - 1: PRINT " ";
  465. IF mov% = -1 THEN PRINT " ";
  466.  
  467.  
  468. DEFINT A-H, J-Z
  469. SUB qbide
  470. PALETTE 2, 59
  471. COLOR 15, 1
  472.  
  473. COLOR 0, 7
  474. LOCATE 1, 1
  475. LOCATE 1, 1: PRINT "   File  Edit  View  Search  Run  Debug  Calls  Options                   Help"
  476.  
  477. COLOR 7, 1
  478.  
  479. LOCATE 2, 1: PRINT CHR$(218)
  480. LOCATE 2, 2: PRINT STRING$(78, CHR$(196))
  481. LOCATE 2, 80: PRINT CHR$(191)
  482.  
  483. LOCATE 2, 76: PRINT CHR$(180)
  484. LOCATE 2, 78: PRINT CHR$(195)
  485.  
  486. COLOR 1, 7
  487. LOCATE 2, 77: PRINT CHR$(24)
  488. LOCATE 2, 36: PRINT " Untitled "
  489.  
  490. COLOR 7, 1
  491. FOR Rows = 3 TO 24
  492.     LOCATE Rows, 1: PRINT CHR$(179);
  493.     LOCATE Rows, 80: PRINT CHR$(179);
  494. NEXT Rows
  495.  
  496. LOCATE 22, 1: PRINT CHR$(195)
  497. LOCATE 22, 80: PRINT CHR$(180)
  498. LOCATE 22, 2: PRINT STRING$(78, CHR$(196))
  499. LOCATE 22, 35
  500. PRINT " Immediate "
  501.  
  502. COLOR 0, 7
  503. LOCATE 21, 3: PRINT STRING$(76, CHR$(176))
  504. LOCATE 21, 2: PRINT CHR$(27)
  505. LOCATE 21, 3: PRINT CHR$(219)
  506. LOCATE 21, 79: PRINT CHR$(26)
  507. FOR Rows = 4 TO 19
  508.     LOCATE Rows, 80: PRINT CHR$(176)
  509. NEXT Rows
  510. LOCATE 3, 80: PRINT CHR$(24)
  511. LOCATE 4, 80: PRINT CHR$(219)
  512. LOCATE 20, 80: PRINT CHR$(25)
  513.  
  514. COLOR 0, 3: LOCATE 25, 1: PRINT " <Shift+F1=Help> <F6=Window> <F2=Subs> <F5=Run> <F8=Step> ";
  515. LOCATE 25, 59: PRINT SPACE$(4);
  516. COLOR 0, 3
  517. LOCATE 25, 63: PRINT CHR$(179);
  518. LOCATE 25, 64: PRINT SPACE$(6);
  519. LOCATE 25, 68: PRINT "C  00001:001 ";
  520.  
  521.  
  522. DEFSNG A-H, J-Z
  523. SUB reprintaliens (ialiencol, ihitaliens, iresults, i4, i, imothership)
  524. IF ihitaliens > 0 THEN
  525.     ihits = ihits + 1
  526.     IF (ihits + 15) MOD 20 = 0 AND imothership = 0 THEN imothership = -1
  527.     LOCATE bullet%(i), lmargin%: PRINT SPACE$(screenwidth%);
  528.     iltalien(i4) = POS(1)
  529.  
  530.     IF RTRIM$(a(i4)) = "" THEN
  531.         alienforce% = alienforce% - 1
  532.         IF alienforce% = 0 THEN iresults = iresults + 1
  533.         IF bullet%(i) = ileadingrow THEN ileadingrow = ileadingrow - 2
  534.     ELSE
  535.         LOCATE bullet%(i), ialiencol + INSTR(a(i4), "-"): PRINT LTRIM$(RTRIM$(a(i4)))
  536.     END IF
  537.     i2 = ABS(ihitaliens)
  538.     LOCATE iy(i2), ix(i2)
  539.     PRINT " ";: iy(i2) = 0
  540.     ia(i2) = 0
  541.     LOCATE irow, icol
  542.     SOUND 1000, .5
  543.  
  544. ihitaliens = 0
  545. bullet%(i) = -bullet%(i)
  546.  
  547. COLOR 0, 3
  548. yy% = CSRLIN: xx% = POS(1)
  549. LOCATE 25, 76 - LEN(LTRIM$(STR$(ihits)))
  550. PRINT LTRIM$(STR$(ihits));
  551. LOCATE 25, 80 - LEN(LTRIM$(STR$(imaxalienforce - alienforce%)))
  552. PRINT LTRIM$(STR$(imaxalienforce - alienforce%));
  553. LOCATE yy%, xx%
  554. COLOR 7, ibk
  555.  
  556.  

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: Tutorials etc
« Reply #4 on: May 29, 2018, 10:40:13 pm »
What? No shields or score? Nah kidding. Cool game. Trigger finger now aches a little, but still, cool game.

You know I'm going to pick this one to bits... lol  I promise not to damage it... too much...

Thank you.

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Tutorials etc
« Reply #5 on: May 30, 2018, 09:46:16 am »
Hi Johnno and all of us still learning,

Dang, petesqbsite is pretty impressive! Looks like the games you (Johnno) like too.

Check out the Help Wiki at QB64 ORG site, not only is there Keywords in Alpha Order, there is also Articles and Tutorials on various topics. Instead of brute force study of Index you can search an actual topic you need to know more about.

Also at same Wiki, you can study Keywords by Usage! You don't know the name of the command, no problem, just find the topic area of interest and see ALL Keywords used and how they are applied under that topic.

The problem is not that there isn't enough information out there, the problem is there is too much! ;D

Yeah Pete!
Yes! Cool game for text/ascii characters!!! Who needs graphics? It even works with mouse control and not the dang arrow keys. Dang! The old mouse driver code too! I haven't seen that since 4.5, that still works!?!
« Last Edit: May 30, 2018, 10:43:35 am by bplus »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Tutorials etc
« Reply #6 on: June 14, 2018, 05:13:09 pm »
Hi Guys

I have seen that fantastic QB45 space invader in ASCII...

there is also some sound effects!
Good Stuff Pete
Programming isn't difficult, only it's  consuming time and coffee