Author Topic: Race Car Game  (Read 13449 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Race Car Game
« Reply #30 on: July 16, 2019, 07:06:51 pm »
I played it once. I really like the bonus "extra" car. Oil slicks still don't kick in at higher speeds, but work great at more moderate speeds. I like the ore realistic speeds in version 3.

I noticed Atari Pole position has both the curbs and center divider moving. Activision Enduro has no center divider, only the curbs move. Neither have oil slicks, which makes me think I must have been playing some game at an arcade to have experienced that, oh well...

Here is my maiden voyage score...

 
race-car.jpg


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

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #31 on: July 16, 2019, 07:36:03 pm »
GREAT JOB! I noticed that the oil slicks do slow it down, but not as much as it would going slower with the car. That's because I use a smaller _DELAY number when the car is going faster. The main loop of the program goes faster when the car goes faster. There's nothing I can really do to help that except make the _DELAY longer and the game slower but I don't want to do that. lol I also tried making the car skid off the road when you hit an oil slick, maybe I should add that back in? It does get annoying though since sometimes I keep hitting the oil slicks. I think I'm just going to leave it as it is regarding the oil slicks.
« Last Edit: July 16, 2019, 07:37:34 pm by SierraKen »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Race Car Game
« Reply #32 on: July 16, 2019, 09:46:53 pm »
Ken, about RANDOMIZE TIMER. You only have to use it once in the program. That will save you some steps in future endeavors.

Edit: Removed copy of program with modified code to communicate a modification in oil slick effects.

Pete
« Last Edit: July 17, 2019, 01:47:17 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #33 on: July 16, 2019, 09:59:52 pm »
I just got 761049 by driving slower, beating Electro Joe like you did..... Wow your version does work better! The reason I added collision2 is because I thought it would be too much for the computer, but I guess it doesn't. Is that the only change you did? Removing the 1 IF/THEN line? I like this version better than mine lol. Thank you! This will go on my website soon.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #34 on: July 16, 2019, 10:12:00 pm »
I deleted all the lines that had collision2 on it and it seems to run great! Thanks again! Here is the updated version. I don't know all lines you changed, but here is mine:

Code: QB64: [Select]
  1. 'I've wanted to make this game since I was a kid when I owned a little hand-held race car game where you steered the little wheel"
  2. 'to avoid the other cars. That toy broke when I was a kid so I've wanted a similar one on the computer. :)
  3. 'Enjoy!
  4. '
  5. 'Version 3 was made on July 16, 2019 by Ken G.
  6. 'Freeware only.
  7. '
  8. 'Thanks to the QB64.org forum guys for the help!
  9. _TITLE "RACE CAR"
  10. SCREEN _NEWIMAGE(640, 480, 32)
  11. begin:
  12. PRINT "                              R  A  C  E    C  A  R"
  13. PRINT "                                       V. 3"
  14. PRINT "                                    By Ken  G."
  15. PRINT "                    Use your arrow keys to steer your car"
  16. PRINT "                    around the other cars and go as far as you"
  17. PRINT "                    can without hitting them, as well as the round"
  18. PRINT "                    oil slicks. You get an extra car every 3000 points."
  19. PRINT "                    Press the up and down arrow keys to move"
  20. PRINT "                    faster or slower and also to stop turning."
  21. PRINT "                    You get 5 cars."
  22. PRINT "                    Every time you hit a street edge, you"
  23. PRINT "                    lose 200 points."
  24. PRINT "                    Every time you hit an oil slick your car"
  25. PRINT "                    moves a random direction."
  26. PRINT "                    Every time you hit another car you lose a car."
  27. PRINT "                    To reset the Top Ten score sheet, delete the file"
  28. PRINT "                    named toptenracers.txt and play a full game."
  29. INPUT "                    Press Enter to play!", a$
  30.  
  31. DIM name$(50), score(50), nm$(50), scc(50)
  32. LINE (0, 240)-(640, 240), _RGB32(127, 255, 127)
  33. tim = .02
  34. t2 = 0
  35. rc = 5
  36. x = 320
  37. y = 250: yy = 450
  38. cx = 350: cy = 420
  39. u = 1
  40. sc = 0
  41. one = 0
  42. collision = 0
  43. o = 0
  44. other = 0
  45. sct = 0
  46. go:
  47. _DELAY tim
  48. _LIMIT 200
  49. a$ = INKEY$
  50. IF a$ = CHR$(27) THEN END
  51. IF a$ = CHR$(0) + CHR$(72) THEN
  52.     u = 1
  53.     d = 0
  54.     r = 0
  55.     L = 0
  56.     tim = tim - .002
  57.     IF tim < .008 THEN tim = .008
  58. IF a$ = CHR$(0) + CHR$(80) THEN
  59.     u = 0
  60.     d = 1
  61.     r = 0
  62.     L = 0
  63.     tim = tim + .002
  64.     IF tim > .02 THEN tim = .02
  65.  
  66. IF a$ = CHR$(0) + CHR$(77) THEN r = 1: L = 0
  67. IF a$ = CHR$(0) + CHR$(75) THEN L = 1: r = 0
  68.  
  69. IF u = 1 THEN
  70.     GOSUB linesmoving:
  71.  
  72. IF d = 1 THEN
  73.     GOSUB linesmoving:
  74.  
  75. IF r = 1 THEN
  76.     ocx = cx: ocy = cy
  77.     GOSUB erasecar:
  78.     cx = cx + 2
  79.     'Check street edge.
  80.     IF cx > 570 THEN
  81.         cx = 550
  82.         SOUND 800, .25
  83.         sc = sc - 200
  84.     END IF
  85.     GOSUB drawcar:
  86.  
  87.  
  88. IF L = 1 THEN
  89.     ocx = cx: ocy = cy
  90.     GOSUB erasecar:
  91.     cx = cx - 2
  92.     'Check street edge.
  93.     IF cx < 40 THEN
  94.         cx = 60
  95.         SOUND 800, .25
  96.         sc = sc - 200
  97.     END IF
  98.     GOSUB drawcar:
  99. 'Street Sides
  100. LINE (320, 240)-(0, 480), _RGB32(127, 255, 127)
  101. LINE (320, 240)-(640, 480), _RGB32(127, 255, 127)
  102. GOSUB drawcar:
  103.  
  104. 'Other Car
  105. oc = INT(RND * 1000) + 1
  106. IF oc > 980 AND occ = 0 THEN
  107.     occ = 1
  108.     oxx2 = (RND * 16) - 8
  109.     oyyy = 250
  110.     oxxx = 305
  111. IF occ = 1 THEN
  112.     oldoyyy = oyyy
  113.     oldoxxx = oxxx
  114.     oyyy = oyyy + 5
  115.     oxxx = oxxx + oxx2
  116.     LINE (oldoxxx, oldoyyy)-(oldoxxx + 30, oldoyyy + 30), _RGB32(0, 0, 0), BF
  117.     CIRCLE (oldoxxx, oldoyyy + 5), 5, _RGB32(0, 0, 0)
  118.     CIRCLE (oldoxxx + 30, oldoyyy + 5), 5, _RGB32(0, 0, 0)
  119.     CIRCLE (oldoxxx + 30, oldoyyy + 25), 5, _RGB32(0, 0, 0)
  120.     CIRCLE (oldoxxx, oldoyyy + 25), 5, _RGB32(0, 0, 0)
  121.  
  122.     LINE (oxxx, oyyy)-(oxxx + 30, oyyy + 30), _RGB32(127, 249, 127), BF
  123.     CIRCLE (oxxx, oyyy + 5), 5, _RGB32(127, 227, 127)
  124.     CIRCLE (oxxx + 30, oyyy + 5), 5, _RGB32(127, 227, 127)
  125.     CIRCLE (oxxx + 30, oyyy + 25), 5, _RGB32(127, 227, 127)
  126.     CIRCLE (oxxx, oyyy + 25), 5, _RGB32(127, 227, 127)
  127.  
  128.     IF oyyy > 640 THEN
  129.         occ = 0
  130.         LINE (oxxx, oyyy)-(oxxx + 20, oyyy + 20), _RGB32(0, 0, 0), BF
  131.         CIRCLE (oldoxxx, oldoyyy + 5), 5, _RGB32(0, 0, 0)
  132.         CIRCLE (oldoxxx + 30, oldoyyy + 5), 5, _RGB32(0, 0, 0)
  133.         CIRCLE (oldoxxx + 30, oldoyyy + 25), 5, _RGB32(0, 0, 0)
  134.         CIRCLE (oldoxxx, oldoyyy + 25), 5, _RGB32(0, 0, 0)
  135.         IF collision = 0 THEN
  136.             other = other + 1
  137.             LOCATE 1, 20: PRINT "Passed Up Cars:"; other
  138.         END IF
  139.         oyyy = 250
  140.         oxxx = 320
  141.         collision = 0
  142.         GOTO nex:
  143.     END IF
  144. nex:
  145.  
  146. 'Detect Collision
  147. IF cx > oxxx - 10 AND cx < oxxx + 40 AND cy > oyyy - 5 AND cy < oyyy + 35 THEN
  148.     SOUND 800, .25
  149.     IF collision = 0 THEN rc = rc - 1
  150.     IF rc = 0 THEN GOTO done:
  151.     collision = 1
  152.  
  153.  
  154. 'Oil Slick
  155. oil = INT(RND * 100) + 1
  156. IF oil > 98 AND oil2 = 0 THEN
  157.     oil2 = 1
  158.     oilx2 = (RND * 12) - 6
  159.     oilyyy = 250
  160.     oilxxx = 305
  161. IF oil2 = 1 THEN
  162.     oldoilyyy = oilyyy
  163.     oldoilxxx = oilxxx
  164.     oilyyy = oilyyy + 5
  165.     oilxxx = oilxxx + oilx2
  166.     o = o + 1
  167.     IF o = 1 THEN GOTO oil:
  168.     FOR ooo = 1 TO 25 STEP 5
  169.         CIRCLE (oldoilxxx, oldoilyyy + 25), ooo, _RGB32(0, 0, 0)
  170.     NEXT ooo
  171.     oil:
  172.     FOR ooo = 1 TO 25 STEP 5
  173.         CIRCLE (oilxxx, oilyyy + 25), ooo, _RGB32(127, 227, 127)
  174.     NEXT ooo
  175.     IF oilyyy > 640 THEN
  176.         FOR ooo = 1 TO 25 STEP 5
  177.             CIRCLE (oldoilxxx, oldoilyyy + 25), ooo, _RGB32(0, 0, 0)
  178.         NEXT ooo
  179.         oilyyy = 250
  180.         oilxxx = 330
  181.         o = 0
  182.         oil2 = 0
  183.         GOTO nex2:
  184.     END IF
  185.  
  186. nex2:
  187.  
  188. 'Detect Collision With Oil Slick
  189. IF cx > oilxxx - 5 AND cx < oilxxx + 35 AND cy > oilyyy - 5 AND cy < oilyyy + 35 THEN
  190.     SOUND 800, .25
  191.     skid = INT(RND * 100) + 1
  192.     IF skid > 50 THEN r = 1: L = 0
  193.     IF skid <= 50 THEN L = 1: r = 0
  194.     tim = .02
  195.     SOUND 900, .25
  196.  
  197. 'Buildings
  198. b = INT(RND * 100) + 1
  199. IF b > 80 AND b2 = 0 THEN
  200.     b2 = 1
  201.     bx2 = (RND * 4) - 2
  202.     IF bx2 > 0 THEN
  203.         RANDOMIZE TIMER
  204.         bxxx = INT(RND * 200) + 370
  205.         bx3 = 10
  206.     END IF
  207.     IF bx2 <= 0 THEN
  208.         RANDOMIZE TIMER
  209.         bxxx = INT(RND * 150) + 10
  210.         bx3 = -10
  211.     END IF
  212.     bsz = INT(RND * 30) + 10
  213.     bsz2 = INT(RND * 30) + 10
  214.     byyy = 255
  215. IF b2 = 1 THEN
  216.     oldbyyy = byyy
  217.     oldbxxx = bxxx
  218.     byyy = byyy + 5
  219.     bxxx = bxxx + bx3
  220.     ob = ob + 1
  221.     IF ob = 1 THEN GOTO building:
  222.     'old erase
  223.     LINE (oldbxxx, oldbyyy)-(oldbxxx + bsz, oldbyyy + bsz2), _RGB32(0, 0, 0), B
  224.     building:
  225.     'new
  226.     LINE (bxxx, byyy)-(bxxx + bsz, byyy + bsz2), _RGB32(127, 227, 127), B
  227.     IF byyy > 640 THEN
  228.         'old erase again
  229.         LINE (oldbxxx, oldbyyy)-(oldbxxx + bsz, oldbyyy + bsz2), _RGB32(0, 0, 0), B
  230.         byyy = 250
  231.         ob = 0
  232.         b2 = 0
  233.         GOTO nex3:
  234.     END IF
  235.  
  236. nex3:
  237.  
  238. bb = INT(RND * 100) + 1
  239. IF bb > 80 AND bb2 = 0 THEN
  240.     bb2 = 1
  241.     bbx2 = (RND * 4) - 2
  242.     IF bbx2 > 0 THEN
  243.         RANDOMIZE TIMER
  244.         bbxxx = INT(RND * 200) + 350
  245.         bbx3 = 10
  246.     END IF
  247.     IF bbx2 <= 0 THEN
  248.         RANDOMIZE TIMER
  249.         bbxxx = INT(RND * 150) + 10
  250.         bbx3 = -10
  251.     END IF
  252.     bbsz = INT(RND * 30) + 10
  253.     bbsz2 = INT(RND * 30) + 10
  254.     bbyyy = 255
  255. IF bb2 = 1 THEN
  256.     oldbbyyy = bbyyy
  257.     oldbbxxx = bbxxx
  258.     bbyyy = bbyyy + 5
  259.     bbxxx = bbxxx + bbx3
  260.     obb = obb + 1
  261.     IF obb = 1 THEN GOTO building:
  262.     'old erase
  263.     LINE (oldbbxxx, oldbbyyy)-(oldbbxxx + bbsz, oldbbyyy + bbsz2), _RGB32(0, 0, 0), B
  264.     building2:
  265.     'new
  266.     LINE (bbxxx, bbyyy)-(bbxxx + bbsz, bbyyy + bbsz2), _RGB32(127, 227, 127), B
  267.     IF bbyyy > 640 THEN
  268.         'old erase again
  269.         LINE (oldbbxxx, oldbbyyy)-(oldbbxxx + bbsz, oldbbyyy + bbsz2), _RGB32(0, 0, 0), B
  270.         bbyyy = 250
  271.         obb = 0
  272.         bb2 = 0
  273.         GOTO nex4:
  274.     END IF
  275. nex4:
  276.  
  277. 'Extra Car
  278. IF sc / 3000 = INT(sc / 3000) AND sc / 3000 <> 0 THEN
  279.     rc = rc + 1
  280.     LOCATE 15, 35: PRINT "EXTRA CAR!"
  281.     SOUND 400, 2
  282.     SOUND 400, 2
  283.     SOUND 400, 2
  284.     t2 = 1
  285. IF t2 > 500 THEN
  286.     LOCATE 15, 35: PRINT "          "
  287.     t2 = 0
  288. IF t2 > 0 THEN t2 = t2 + 1
  289.  
  290. 'Speed Indicator
  291. LOCATE 3, 1: PRINT "Speed: "; INT(1.5 / tim)
  292. LOCATE 3, 13: PRINT "mph"
  293. 'Score
  294. IF sc < 1 THEN sc = 1
  295. LOCATE 1, 1: PRINT "Score: "; sc
  296. sc = sc + 1
  297. 'Cars You Have Leftover
  298. LOCATE 1, 73: PRINT "Cars:"; rc
  299.  
  300.  
  301. GOTO go:
  302.  
  303. linesmoving:
  304. oy = y
  305. y = y + 5
  306. IF y > 640 THEN y = 250
  307. IF y < 240 THEN y = 640
  308. LINE (x, oy)-(x, oy + 10), _RGB32(0, 0, 0)
  309. LINE (x, y)-(x, y + 10), _RGB32(127, 255, 127)
  310. oyy = yy
  311. yy = yy + 5
  312. IF yy > 640 THEN yy = 250
  313. IF yy < 240 THEN yy = 640
  314. LINE (x, oyy)-(x, oyy + 10), _RGB32(0, 0, 0)
  315. LINE (x, yy)-(x, yy + 10), _RGB32(127, 255, 127)
  316.  
  317.  
  318. drawcar:
  319. 'Car
  320. LINE (cx, cy)-(cx + 30, cy + 30), _RGB32(127, 227, 127), BF
  321. LINE (cx + 5, cy - 5)-(cx + 25, cy), _RGB32(127, 227, 127), BF
  322. CIRCLE (cx, cy + 5), 5, _RGB32(127, 227, 127)
  323. CIRCLE (cx + 30, cy + 5), 5, _RGB32(127, 227, 127)
  324. CIRCLE (cx + 30, cy + 25), 5, _RGB32(127, 227, 127)
  325. CIRCLE (cx, cy + 25), 5, _RGB32(127, 227, 127)
  326.  
  327. erasecar:
  328. LINE (ocx, ocy)-(ocx + 30, ocy + 30), _RGB32(0, 0, 0), BF
  329. LINE (ocx + 5, ocy - 5)-(ocx + 25, ocy), _RGB32(0, 0, 0), BF
  330. CIRCLE (ocx, ocy + 5), 5, _RGB32(0, 0, 0)
  331. CIRCLE (ocx + 30, ocy + 5), 5, _RGB32(0, 0, 0)
  332. CIRCLE (ocx + 30, ocy + 25), 5, _RGB32(0, 0, 0)
  333. CIRCLE (ocx, ocy + 25), 5, _RGB32(0, 0, 0)
  334.  
  335. done:
  336. LOCATE 10, 30: PRINT "G A M E    O V E R"
  337. LOCATE 1, 1: PRINT "Score: "; sc
  338. scc = sc * other
  339. LOCATE 14, 1: PRINT sc; " x "; other; " Passed Up Cars = Total Score: "; scc
  340. LOCATE 1, 73: PRINT "Cars:"; rc
  341. LOCATE 20, 1: INPUT "Press Enter to see Top Ten list.", topten$
  342.  
  343. 'Top Ten Racers
  344. IF _FILEEXISTS("toptenracers.txt") THEN
  345.     OPEN "toptenracers.txt" FOR OUTPUT AS #1
  346.     RESTORE toptendata
  347.     DO
  348.         READ toptenname$, toptenscore!
  349.         IF toptenname$ = "EOF" THEN EXIT DO
  350.         PRINT #1, toptenname$
  351.         PRINT #1, toptenscore!
  352.     LOOP
  353.     CLOSE #1
  354.  
  355. OPEN "toptenracers.txt" FOR INPUT AS #1
  356. FOR n = 1 TO 10
  357.     IF EOF(1) THEN GOTO nex5:
  358.     INPUT #1, name$(n)
  359.     INPUT #1, score(n)
  360.     IF scc > score(n) AND sct = 0 THEN
  361.         nn = n
  362.         PRINT "You have made the Top Ten!"
  363.         typename:
  364.         INPUT "Type your name here (25 letters and spaces maximum.):", nm$(nn)
  365.         IF LEN(nm$(nn)) > 25 THEN
  366.             PRINT "Name too long, try again."
  367.             GOTO typename:
  368.         END IF
  369.         sccc(nn) = scc
  370.         sct = 1
  371.     END IF
  372.     IF n = 10 AND sct = 0 THEN CLOSE #1: GOTO nex7:
  373. nex5:
  374. OPEN "toptenracers.txt" FOR OUTPUT AS #1
  375. FOR n = 1 TO nn
  376.     IF n <> nn THEN PRINT #1, name$(n): PRINT #1, score(n)
  377.     IF n = nn THEN
  378.         PRINT #1, nm$(n)
  379.         PRINT #1, sccc(n)
  380.     END IF
  381. nex6:
  382. FOR n = nn TO 10
  383.     PRINT #1, name$(n): PRINT #1, score(n)
  384.  
  385. nex7:
  386. PRINT "                            T O P    T E N     R A C E R S"
  387. OPEN "toptenracers.txt" FOR INPUT AS #1
  388. FOR n = 1 TO 10
  389.     IF EOF(1) THEN GOTO nex8:
  390.     INPUT #1, name$(n)
  391.     INPUT #1, score(n)
  392.     PRINT "             "; n; ". "; name$(n); score(n)
  393. nex8:
  394. FOR n = 1 TO 10
  395.     nm$(n) = ""
  396.     score(n) = 0
  397.     name$(n) = ""
  398.     sccc(n) = 0
  399.  
  400. LOCATE 23, 1
  401. INPUT "Would you like to play again? (Yes/No)", ag$
  402. IF ag$ = "y" OR ag$ = "Y" OR ag$ = "YES" OR ag$ = "yes" OR ag$ = "Yes" OR ag$ = "yES" OR ag$ = "yeS" THEN GOTO begin:
  403.  
  404. toptendata:
  405. DATA Electro Joe,500000
  406. DATA Flying Felice,450000
  407. DATA Speedy Spencer,400000
  408. DATA Super Sam,350000
  409. DATA Ralph Runner,300000
  410. DATA Suzy Swift,275000
  411. DATA Quick Ken,250000
  412. DATA Tiger Tessa,225000
  413. DATA Brisk Bob,200000
  414. DATA Jalopy Jay,175000
  415.  
  416.  
« Last Edit: July 16, 2019, 10:15:22 pm by SierraKen »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Race Car Game
« Reply #35 on: July 16, 2019, 10:37:57 pm »
I tweaked the delay and added a timer. I also increased the collision parameters for the oil slicks. The effect is to kill the speed by 3x wen you hit an oil slick, but over 3/4 of a second, it progressively adds speed, until it's back to the original speed it was traveling at, before it hit the skids!

Anyway, I'll keep it up for now.

The lines changed are roughly...

IF cx > oilxxx - 25 AND cx < oilxxx + 35 AND cy > oilyyy - 25 AND cy < oilyyy + 35 THEN ' Changed collisions parameters.

I moved...

IF tim < .008 THEN tim = .008 ' Moved to under Go: It needed to be encountered sooner to offset faster speeds oil slicks reducing the delay below zero. I know, I estimated pretty good, but I didn't want to spend the extra time for exact math.

I removed this block if statement:  IF collision2 = 0 THEN ... END IF

I added: IF z1 = 0 THEN oldtim = tim: tim = tim * 3: z1 = TIMER  ' This line saves the old delay, starts a timer, and decreases speed by 3x.

Finally, I added this before the GOTO Go line...

IF z1 THEN
    IF ABS(z1 - TIMER) >= .75 THEN ' This event is triggered after .75 seconds after an oil slick collision.
        tim = oldtim
        z1 = 0
    ELSE
        tim = tim - .0005 ' This progressively lets the car speed back up, simulating the skid effect.
    END IF
END IF

Anyway, I hope that helps. Sorry for the initial lack of explanation. I love to code, but I never used to comment my own code, either.

Pete




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

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #36 on: July 16, 2019, 10:59:43 pm »
Well I'm glad that works better for you. I think every computer is slightly different on things and I like the way my code is right now, so I'm not going to go dig into this deeper. But I appreciate you trying to help. Your IF/THEN collision2 stuff really makes the game sound better. To me, programming is like an art form and the more of other people's stuff I add to it, the less I feel it's mine. Except of course for 1 or 2 lines which I can understand how to do. But adding other stuff that I haven't really done before I really can't do it. This is like my little creation. lol Of course comments and suggestions are always welcome. :)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #37 on: July 17, 2019, 12:11:32 am »
I got the game on my website now. I thanked "the guys at the QB64.org forum" again on the page for helping me with this. You can see all my programs and games here:
http://www.kensprograms.com/

The Race Car game is at the bottom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Race Car Game
« Reply #38 on: July 17, 2019, 01:19:02 am »
I do miss the joystick and paddle controllers. I made a mouse version with mouse wheel accelerator. It's not as good as a joystick, but I'm just not a fan of the keyboard for games. I got used to the center divider. Without the curbs moving, like in Activision Enduro, yes, you need that for the speed effect. It just took me awhile to get the missiles from Space Invaders out of my head. Go figure.

Great Game!

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

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Race Car Game
« Reply #39 on: July 17, 2019, 02:06:18 am »
Hi. The joystick is supported in QB64 (I never tried it because I don't have one), it should be STRIG statement for  activating read joystick envents  and STRIG function to handle the joystick buttons.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Race Car Game
« Reply #40 on: July 17, 2019, 12:26:40 pm »
Cool game. Much better than the original version. Nicely done!

Unfortunately, my poor driving skills, prevented me from getting onto the high score table... lol
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #41 on: July 17, 2019, 12:36:49 pm »
Thanks Johno :).

That's awesome about the joystick control, I might still have one somewhere to use. Are they USB ones or the old Com Port?

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Race Car Game
« Reply #42 on: July 17, 2019, 01:44:32 pm »
Hi Petr,

Yes, I'm aware of those QB64 statements, but like you, I'm stickless, or maybe it's joyless. Wait, either way, that didn't come out right.

To all,

Kidding aside, I'm have so much fun with this. I made some modifications, which include using the right and left mouse buttons to accelerate and brake. That works better than the mouse wheel, as it has more of a pedal feel. Moving the mouse right to left steers the car. Steering and acceleration / deceleration can be done at the same time.

As most of you know, I don't do graphics, but I was one of the four people in on that tool box project for ellipse fill. I decided to study the code, and found it wasn't difficult at all to substitute solid filled dark grey ellipses for the oil slick circles. I also tweaked some delays to smooth out the modifications, and I think the end product came out pretty well.

I'd love to post the project as modified, but maybe if I can get Ken's permission, I'd post it on the QBasic Forum. That would prevent  muddying up Ken's project here. I also removed the code I posted yesterday, for the same reason. I just wanted to communicate what I was doing, and not hijack the project. It's a lot easier to show it than say it, that's for sure. Anyway, this is one of the few graphics projects that sparked my interest.

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

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Race Car Game
« Reply #43 on: July 17, 2019, 02:01:16 pm »
Hi Pete. I hope SierraKen gives you permission, I'd like to try it :-D

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Race Car Game
« Reply #44 on: July 17, 2019, 02:07:42 pm »
Pete, you didn't have to delete your stuff. But sure, go ahead and post it anywhere you wish, but please keep my name somewhere on it as well, like on the top of the code you can put this:
'Original game design by Ken G., modified with permission by Pete.
Or something like that. You really don't even need the "with permission" part. And I apologize if I came across too stern with yesterday's post, I just wanted to say something about it. But, just like the reason why I put the codes on my website, is to teach people and let them go at it. :) But see, I just wanted the ORIGINAL one mostly by me anyway. :) After that, they are all out there in the wild. LOL I probably should say that in my Terms of Use page on my website, it says that if people ever want to sell my code for themselves, please don't use more than half of the code. But that is only for selling of course. To see my Terms of Use page, go to the very bottom of my website to the link, or go directly to it here: http://www.kensprograms.com/terms.html