Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - fistfullofnails

Pages: [1]
1
QB64 Discussion / Re: Arduino a possibility with QB64?
« on: July 25, 2021, 03:14:03 pm »
Thanks.  I’m not really familiar with the code that those posts are pasting, but I do see that at least some aspects are possible.  Since my original post, I see that pre-arduino, there was a microcontroller called the BStamp? that used a flavor of Basic to program it. 

2
QB64 Discussion / Arduino a possibility with QB64?
« on: July 22, 2021, 12:23:38 am »
I’m a long time noob due to my severe ADHD and just being a slow learner in general.  I’ve been away for a while due to abandoning the QB64 ship and drifting into C programming and Arduino.  And to be honest, I feel dumber now than before after the hiatus.  I don’t know what it is about QB, but things seemed to stick and I actually felt like I could half think like a programmer when studying it. 

After months of C and whatever the arduino language is, I still feel like I’ve gone brain dead and can’t retain any of that stuff.  Plus creativity plunges to nothing.

Anyways, i was just curious if it would be possible to write some sort of libraries or whatnot that would allow someone to interface with an Arduino and program it using QB64.  I don’t know much about computing itself, so if it’s not possible, I’m interested in knowing why.

3
QB64 Discussion / Re: Tutorial
« on: May 20, 2021, 02:43:54 am »
I have the LED screen building laid out in the 3 steps here:
https://www.qb64.org/forum/index.php?topic=3884.msg132232#msg132232

Holy smokes bplus.  Those tips explained a lot.  Thanks

4
QB64 Discussion / Re: Tutorial
« on: May 08, 2021, 08:55:06 pm »
I have a very difficult time coding, but I’ve made it to task 11, and I remember a few errors.  I feel like it’s a test to see if you are actually staying on your toes or just copying and pasting code, or just typing it in without trying to think about it. 

I very much like it for the most part, until there’s a program like the calendar with the scrolling led display.  I feel a lot of it went unexplained and well over my head. 

When you mentioned something about a chess piece being displayed, it really threw me off.  I definitely do not recall encountering anything like that.

5
Oh heck I thought you wanted to draw circles!

I was just trying to draw circles.  I was trying to draw simple circles using an array.  It's just that some were saying that I was trying to plug commands into an array in my original code I posted here, when it had appeared to me that was what Ritchie was doing in the tutorial you are looking at that I had posted.  I'm guessing that something like _rgb32(255, 0, 255) isn't considered a command?  I'm once again guessing that  _rgb32(255, 0, 255) just turns out to be a long integer in the end, so that an array would accept it?  While circle(80, 50), 25, _rgb32(255, 0, 255) is an actual command, so wouldn't be accepted into an array?  I don't want to offend anyone here, but I'm not really interested in getting into TYPES and such, when I haven't even come to grips with basic arrays it seems. 

6
OK, so this is Terry Ritchie's game programming tutorial.  What I've been doing is once I go over a section, I try and go back and do something similar, yet simpler, to prove to myself that I may understand it.  I don't believe that just copying the code and moving on does much for me as to retaining things.  Is he not putting multiple commands into his Cir(Count%) array? For instance, Is  Cir(Count%).c = _RGB32(Red%, Green%, Blue%) not a command?



Code: QB64: [Select]
  1. '------------------------    -------------
  2. 'variable declaration
  3. '----------------------------------
  4.  
  5. Type CIRCLETYPE
  6.     x As Single
  7.     y As Single
  8.     c As _Unsigned Long
  9.     r As Integer
  10.     xdir As Single
  11.     ydir As Single
  12.  
  13. Const CIRCLES = 50
  14. Const SCREENWIDTH = 640
  15. Const SCREENHEIGHT = 480
  16.  
  17. Dim Cir(CIRCLES - 1) As CIRCLETYPE
  18. Dim Count%
  19. Dim Red%, Green%, Blue%
  20. Dim OkToPaint%
  21.  
  22. '---------------------------------------
  23. 'Main
  24. '-----------------
  25.  
  26. For Count% = 0 To CIRCLES - 1
  27.     Cir(Count%).x = SCREENWIDTH / 2 - 1
  28.     Cir(Count%).y = SCREENHEIGHT / 2 - 1
  29.     Red% = Int(Rnd(1) * 256)
  30.     Green% = Int(Rnd(1) * 256)
  31.     Blue% = Int(Rnd(1) * 256)
  32.     Cir(Count%).c = _RGB32(Red%, Green%, Blue%)
  33.     Cir(Count%).r = Int(Rnd(1) * 40) + 11
  34.     Cir(Count%).xdir = (Rnd(1) * 2 - Rnd(1) * 2) * 2
  35.     Cir(Count%).ydir = (Rnd(1) * 2 - Rnd(1) * 2) * 2
  36. Next Count%

7
Code: QB64: [Select]
  1. Dim circles% 'total number of circles
  2. Dim x% 'location of circles
  3. Dim y%
  4. Dim circolor% 'color of circle
  5. Dim rad% 'radius of circle
  6. Dim entity% 'individual circle
  7.  
  8. '----------------------
  9. 'assign circle attributes
  10. '----------------------
  11.  
  12. circles = 5
  13.  
  14.  
  15. For i = 1 To circles
  16.     x = Int(Rnd * 300)
  17.     y = Int(Rnd * 300)
  18.     rad = Int(Rnd * 50)
  19.     red% = Int(Rnd * 255)
  20.     green% = Int(Rnd * 255)
  21.     blue% = Int(Rnd * 255)
  22.     entity(i) = circle(x, y), rad,  _RGB32(red%, green%, blue%)
  23.  

then says:
"Name already in use on current line.  Caused by  (or after)
entity(i) = circle(x, y), rad,  _RGB32(red%, green%, blue%)

8
QB64 Discussion / Re: help with arrays and DATA to make game maps
« on: April 24, 2021, 05:55:57 pm »
Thanks for your explanations folks.  I literally spent four hours last night staring at the first two sections of Unseen's code before feeling like I was starting to get it.  I ended up rewriting little parts of those sections and adding print statements to those parts to show me what was actually happening in those parts.  For example, I'd just make up a smaller 2 d array and data set, then run through it, but actually print out what it was reading and so forth.  for example

Code: QB64: [Select]
  1. Dim map(4, 4) As Integer
  2.  
  3.  
  4. For row% = 0 To 4
  5.     For col% = 0 To 4
  6.         Read area%
  7.         map(col%, row%) = area%
  8.         Print "map"; col%; ","; row%; " is equal to: "; area%
  9.  
  10.     Next

I think I was starting to get the drawing part after looking at it briefly toward the end of my night.  Guess i'll spend a couple hours with it as well later.
What immediately jumped out to me at first in the drawing part, was the question as to why the y% and z% variable received the value of 0 in the places that they did.

Code: QB64: [Select]
  1.     y% = 0
  2.     For row% = 0 To 9
  3.         x% = 0
  4.         For col% = 0 To 9

Is there perhaps anything I could apply these concepts to that will give me practice that may be a bit easier to wrap my head around at first?  Or should i just keep inducing headaches into myself?  Maybe I've gotten in too far before understanding some simpler concepts?  Finally, thank you for your time everyone that has tried to help me.

9
QB64 Discussion / Re: help with arrays and DATA to make game maps
« on: April 23, 2021, 01:17:32 pm »
 READ Block%
    IF Block% < 9 THEN
      Map(col%, row%) = Block%

So the program just jumps to the first DATA it sees and uses the nested FOR loop to read that into the map array?  And then the map array is being put into another variable called Block%?  I'm not understanding the purpose of determining if Block% is less than 9 in the if statement.

 IF Map(You(0), You(1) - 1) = 0

I cannot figure out how this math is being done.  Say I was  at location 3,4.  How does this math get solved?  "Map(3, 4 - 1) " is how I'm looking at it.  Or is it taking that grid location's value, which I think is 0, and then doing the math on it.  "0 - 1" and comparing it to zero?




10
QB64 Discussion / help with arrays and DATA to make game maps
« on: April 22, 2021, 07:30:26 pm »
Is there a tutorial somewhere explaining how to design maps using arrays and DATA.  I've got a book on QB64 on kindle by an author called 'Iam Beourd' haha, and he/she gets into designing a map.  They lay out a DATA table consisting of the numbers 0-5 or so, with a zero representing an empty room, a one representing a room containing an enemy, and so on.  I'm having difficulty understanding how it all comes together.  Especially how the player navigates through these rooms and the computer knowing which one you are in.  I'm also have trouble how 'inforoom' is actually working to give statements about each room.  And finally, the math being used to place the "wall" graphics is something I don't really get at all.  Is there a simpler version of something similar that is explained for dummies, or is this as dumbed down as it gets and I just happen to be dumber?

Code: QB64: [Select]
  1. _Title "MAZER"
  2.  
  3. Screen _NewImage(800, 600, 32)
  4. Dim map(10, 10) As Integer
  5.  
  6. Dim textwin&
  7. Dim textbox&
  8.  
  9. textwin& = _NewImage(200, 200, 32)
  10. textbox& = _NewImage(410, 200, 32)
  11.  
  12. Dim roominfo(10) As String
  13.  
  14. newgame:
  15. GoSub prep
  16.  
  17. Do Until k$ = "q"
  18.     Cls
  19.     GoSub drawmap
  20.     k$ = InKey$
  21.     Select Case map(x, y)
  22.         Case 1: GoSub infoport
  23.         Case 2: GoSub charger
  24.         Case 3: GoSub infoport
  25.         Case 4: GoSub creature
  26.         Case 5: GoSub shuttle
  27.     End Select
  28.     _Display
  29.  
  30. drawmap:
  31. 'background
  32. Line (80, 80)-(520, 520), _RGB(128, 15, 15), BF
  33. 'floor
  34. Line (100, 100)-(300, 300), _RGB(128, 150, 150), BF
  35. 'the walls are drawn if value in matrix is 0
  36. 'west wall
  37. If map(x - 1, y) = 0 Then
  38.     Line (100, 100)-(110, 300), _RGB(61, 94, 188), BF
  39.     If k$ = "a" Then x = x - 1
  40.  
  41. 'east wall
  42. If map(x + 1, y) = 0 Then
  43.     Line (290, 100)-(300, 300), _RGB(61, 94, 188), BF
  44.     If k$ = "d" Then x = x + 1
  45.  
  46. 'north wall
  47. If map(x, y - 1) = 0 Then
  48.     Line (100, 100)-(300, 110), _RGB(61, 94, 188), BF
  49.     If k$ = "w" Then y = y - 1
  50.  
  51. 'south wall
  52. If map(x, y + 1) = 0 Then
  53.     Line (100, 290)-(300, 300), _RGB(61, 94, 188), BF
  54.     If k$ = "s" Then y = y + 1
  55.  
  56. 'subroutine tht gives feedback for rooms
  57. infoport:
  58. _Dest textbox& 'after this, anything written goes to this image
  59. Print "In search of an escape shuttle, you navigate the rooms.";
  60. Print "Try to avoid alien nests. Some rooms contain a zapper reloader.";
  61. Print "Run out of zaps though, and the aliens will have you."
  62. Print " USE w, a, s, d to move between rooms."
  63. Print " q quits the game"
  64.  
  65. _Dest textwin&
  66. Print roominfo(map(x, y))
  67. _Dest 0 'this sets us back to drawing in the window
  68. _PutImage (100, 310), textbox& 'draws lower text box
  69. _PutImage (310, 100), textwin& 'draws right text box
  70.  
  71. charger:
  72. zap = 3
  73. map(x, y) = 3
  74. _Dest textbox&
  75. Print "you found a charger!"
  76. Print "your zapper has "; zap; "blasts"
  77. Print "the charger broke!"
  78. Print "You can't use it again."
  79.  
  80. _Dest textwin&
  81. Print "hit any key"
  82. _Dest 0 'back to drawing in window
  83. _PutImage (100, 310), textbox&
  84. _PutImage (310, 100), textwin&
  85.  
  86. creature:
  87. If zap > 0 Then
  88.     zap = zap - 1
  89.     map(x, y) = 3
  90.     GoTo gameover
  91.  
  92. _Dest textbox&
  93. Print "You used a blast!"
  94. Print "Your zapper has "; zap; " blasts left"
  95. Print "the creature is gone, the next"
  96. Print "is scraped now."
  97.  
  98. _Dest textwin&
  99. Print "hit enter key"
  100.  
  101. _PutImage (100, 310), textbox&
  102. _PutImage (310, 100), textwin&
  103.  
  104. shuttle:
  105. _Dest textbox&
  106. Print "You made it to the shuttle."
  107. Print "Still sealed and scanned safe"
  108. Print "You escape the ship and set a beacon"
  109. Print "It says NEVER BOARD THIS SHIP!"
  110. _Dest textwin&
  111. Print "Try Again (Y/N)?"
  112. _PutImage (100, 310), textbox&
  113. _PutImage (310, 100), textwin&
  114. GoTo try
  115.  
  116. 'you ran out of zapper loads and alien gets you
  117.  
  118. gameover:
  119. _Dest textbox&
  120. Print "Being as your zapper is empty, the creature"
  121. Print "eats you slowly.  THE END."
  122. Print "Your regret, is never warning others from"
  123. Print "coming to this ship."
  124.  
  125. _Dest textwin&
  126. Print "Try Again (Y/N)?";
  127. _PutImage (100, 310), textbox&
  128. _PutImage (310, 100), textwin&
  129. GoTo try
  130.  
  131. 'decide to try again
  132.  
  133. try:
  134. If m$ = "Y" Or m$ = "y" Then GoTo newgame
  135.  
  136. 'code for default values for game and loads map
  137.  
  138. prep:
  139.  
  140. 'load map from data
  141. Restore mapdata 'restore points to label in data table
  142. ' this loads map
  143. For y = 0 To 10
  144.     For x = 0 To 10
  145.         Read map(x, y)
  146.     Next
  147.  
  148. zap = 3
  149. x = 1
  150. y = 1
  151. 'table of text for describing each room
  152. roominfo(1) = "The room is empty"
  153. roominfo(2) = "zapper filled"
  154. roominfo(3) = "scrap litters the floor"
  155. roominfo(4) = "creature!"
  156. roominfo(5) = "shuttle to safety"
  157.  
  158.  
  159. 'data table laid out in grid for a map
  160. 'will read this to a 2 dimensional array and interpret the numbers
  161. '0 is wall, 1 empty room, 2 refills zapper, etc
  162.  
  163. mapdata:
  164.  
  165. Data 0,0,0,0,0,0,0,0,0,0,0
  166. Data 0,1,1,1,4,1,1,1,1,1,0
  167. Data 0,1,1,1,2,1,1,4,1,1,0
  168. Data 0,1,1,1,1,1,1,1,1,1,0
  169. Data 0,0,0,0,0,0,0,1,0,0,0
  170. Data 0,2,1,4,1,4,1,1,1,1,0
  171. Data 0,0,1,0,0,0,0,0,0,0,0
  172. Data 0,1,1,0,4,1,1,1,1,1,0
  173. Data 0,2,1,0,1,4,1,1,5,1,0
  174. Data 0,1,1,1,1,4,1,1,1,1,0
  175. Data 0,0,0,0,0,0,0,0,0,0,0
  176.  
  177.  

11
QB64 Discussion / Console hiding results
« on: April 08, 2021, 10:46:31 pm »
I’m running the newest version on Windows 10.  I’m doing Terry Ritchie’s game programming tutorial, and I notice when output such as a counter running past 25 lines is shown in the console, that the first part of the output gets hidden due to scrolling down.  I cannot seem to expand the console window itself.  And of course when i press any key, it closes the console.

12
QB64 Discussion / Hello, newbie here
« on: April 05, 2021, 01:29:40 pm »
I've tried to learn programming at least four different times and I do not guess Ive really failed at it, because here I am trying again.  Last attempt was with Smilebasic4 on my switch and I was actually able to progress somewhat in accomplishing some things i was slightly proud of.  However, i hit a wall and the documentation seems to speak as if it presumes you already know a lot of the lingo and have an understanding of some things already.  The only somewhat active forum seemed to also presume you knew what was going on and such.  Even though I've read a lot of trashing of the various forms of Basic on the internet as a first language to learn, it just seems to make sense to me because it doesn't seem to hide? anything much.  It seems things like python seem to run on autopilot in terms of making sense.  Seems as though with python, you are using your phone to translate and speak a foreign language for you and then thinking  you are fluent, but if someone took your phone away, you wouldn't have any idea how to speak in that language anymore.  Whereas with basic, once your translating phone was taken away, you would still have somewhat of an idea and ability to communicate with people, because you know how some of the internals work.  Anyways, I'm hoping this place may have more support for noobs and active community than smilebasic4.  I've looked through the forums and don't really see a particular place for beginner tutorials or whatnot.  Any suggestions on where I might start from the ground up.  I apologize if there is an obvious room for noobs and I missed it.  I have very severe ADHD and I tend to overlook things sometimes.  The ADHD is a large factor in my inability to progress past a certain point on my own.  I get overwhelmed when many terms or concepts I don't know get thrown at me all at once.  I remember when first starting and going to stackoverflow to ask questions, and the answers left me more confused than the original problem i was having.

Pages: [1]