Author Topic: Find The Gold!  (Read 6572 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #15 on: October 25, 2020, 12:39:50 pm »
I just fixed the Title Bar. I forgot to check it when I was trying something on it and it was just saying "Loading...". It works better now too.
Here is also a picture of the new trees. :)

Code: QB64: [Select]
  1. 'Find the Gold! by SierraKen
  2. 'October 24, 2020
  3. 'Thanks for the great mapping code by FellipeHeitor and help from B+!
  4. 'Additions:
  5. 'Body, Arms, and Legs. Levels and 20 gold per level. Larger land area sizes. Lakes and Trees. 20 Level limit.
  6. 'Changed PAINT to CLS , _RGB32(0,200,0) which greatly improves the loading speed.
  7. 'Added 4 times the amount of trees and made 3 levels of mountains.
  8. 'Added random creeks. Added twice the lakes with random shapes.
  9. 'Changed screen size to 800 x 600 to be compatible with all players.
  10. 'Added 100 seconds to level time, to 400 for level 1.
  11. 'Slowed player speed from 10 to 8.
  12. 'Changed to a happier sound when getting gold.
  13. 'Changed color after you get the gold from brown to green.
  14. 'Added WASD keys to move player along with arrow keys.
  15. 'Removed the square mountains and made more realistic hills.
  16. 'Put the lakes on the ground, before everything else.
  17. 'Made trees look better.
  18. 'Removed creeks.
  19. 'Fixed Title Bar.
  20.  
  21. SCREEN _NEWIMAGE(800, 600, 32)
  22.  
  23. TYPE object
  24.     x AS SINGLE
  25.     y AS SINGLE
  26.  
  27. DIM SHARED player AS object
  28. DIM SHARED camera AS object
  29. DIM playerSpeed AS SINGLE
  30.  
  31. _TITLE "Loading....."
  32.  
  33. start:
  34. score = 0
  35. level = 1
  36.  
  37. start2:
  38. player.x = _WIDTH / 2
  39. player.y = _HEIGHT / 2
  40.  
  41. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
  42.  
  43. _DEST map
  44.  
  45. CLS , _RGB32(0, 200, 0)
  46. _LIMIT 2000
  47.  
  48. 'Lakes
  49. FOR lakes = 1 TO 100
  50.     w = RND
  51.     h = RND
  52.     sze = (RND * 250) + 100
  53.     shape = RND
  54.     FOR sz = .25 TO sze STEP .25
  55.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 128, 255), , , shape
  56.     NEXT sz
  57. NEXT lakes
  58.  
  59.  
  60. 'Hills
  61. FOR hills = 1 TO 1200
  62.     xx = (RND * _WIDTH)
  63.     sz = INT(RND * 100) + 200
  64.     shape = RND
  65.     hillcolors:
  66.     c1 = INT(RND * 100) + 55
  67.     c2 = INT(RND * 100) + 55
  68.     c3 = INT(RND * 100) + 55
  69.     IF c1 = 255 AND c2 = 255 AND c3 = 128 THEN GOTO hillcolors:
  70.     yy = yy + 4
  71.     FOR hill = 1 TO sz STEP .25
  72.         hh = hh + .025
  73.         IF hh > 100 THEN hh = 100
  74.         cc1 = c1 + hh
  75.         cc2 = c2 + hh
  76.         cc3 = c3 + hh
  77.         CIRCLE (xx, yy), hill, _RGB32(cc1, cc2, cc3), 2 * _PI, _PI, shape
  78.     NEXT hill
  79.     hh = 0
  80. NEXT hills
  81. yy = 0
  82.  
  83.  
  84. 'Trees
  85. FOR trees = 1 TO 1000
  86.     tx = RND
  87.     tx = tx * _WIDTH
  88.     ty = RND
  89.     ty = ty * _HEIGHT
  90.     tsz = (RND * 40) + 10
  91.     LINE (tx, ty)-(tx, ty + tsz + 5), _RGB32(188, 127, 127)
  92.     FOR branches = ty TO ty + tsz STEP 3
  93.         trim = trim + 2
  94.         LINE (tx, branches)-(tx - trim, branches + 5), _RGB32(0, 183, 127)
  95.         LINE (tx, branches)-(tx + trim, branches + 5), _RGB32(0, 183, 127)
  96.     NEXT branches
  97.     trim = 0
  98. NEXT trees
  99.  
  100. 'Place Gold
  101. FOR gold = 1 TO 20
  102.     gold:
  103.     w2 = INT(RND * _WIDTH) - 40
  104.     h2 = INT(RND * _HEIGHT) - 40
  105.     IF w2 < 40 THEN w2 = 40
  106.     IF h2 < 40 THEN h2 = 40
  107.     IF POINT(w2, h2) = _RGB32(255, 255, 128) THEN GOTO gold:
  108.     IF POINT(w2, h2) = _RGB32(0, 0, 0) THEN GOTO gold:
  109.     'Gold
  110.     COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
  111.     _PRINTSTRING (w2, h2), "GOLD"
  112. NEXT gold
  113.  
  114.  
  115.  
  116. playerSpeed = 8
  117.  
  118. CONST keyUP = 18432
  119. CONST keyDOWN = 20480
  120. CONST keyLEFT = 19200
  121. CONST keyRIGHT = 19712
  122. CONST keyESC = 27
  123. _PUTIMAGE (camera.x, camera.y), map
  124.  
  125. LOCATE 3, 30: PRINT "Use the arrow keys (or WASD keys) to find 20 gold bars per level."
  126. LOCATE 4, 30: PRINT "Every level will have a shorter time."
  127. LOCATE 5, 30: PRINT "After Level 20 you win the game."
  128. LOCATE 10, 40: PRINT "Press Any Key To Begin."
  129. _TITLE "Find The Gold!"
  130. pause:
  131. a$ = INKEY$
  132. IF a$ <> "" THEN GOTO begin:
  133. GOTO pause:
  134. score$ = STR$(score)
  135. level$ = STR$(level)
  136.  
  137.  
  138. begin:
  139. _TITLE "Level: " + level$ + "   Score: " + score$
  140. seconds = INT(TIMER)
  141.     CLS
  142.     leveltime = level * 5
  143.     gametime = (405 - leveltime) - (INT(TIMER) - seconds)
  144.     _PUTIMAGE (camera.x, camera.y), map
  145.     LOCATE 1, 1: PRINT "Time Left: "; gametime
  146.     IF gametime < 1 THEN GOTO done:
  147.     IF _KEYDOWN(keyUP) OR _KEYDOWN(119) THEN
  148.         player.y = player.y - playerSpeed
  149.         t = t + 1
  150.     END IF
  151.     IF _KEYDOWN(keyDOWN) OR _KEYDOWN(115) THEN
  152.         player.y = player.y + playerSpeed
  153.         t = t + 1
  154.     END IF
  155.     IF _KEYDOWN(keyLEFT) OR _KEYDOWN(97) THEN
  156.         player.x = player.x - playerSpeed
  157.         t = t + 1
  158.     END IF
  159.     IF _KEYDOWN(keyRIGHT) OR _KEYDOWN(100) THEN
  160.         player.x = player.x + playerSpeed
  161.         t = t + 1
  162.     END IF
  163.     IF _KEYDOWN(keyESC) THEN END
  164.     IF player.x < 0 THEN player.x = 0
  165.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
  166.     IF player.y < 0 THEN player.y = 0
  167.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
  168.  
  169.     adjustCamera
  170.  
  171.     'Draw Head
  172.     FOR sz = .25 TO 10 STEP .25
  173.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
  174.     NEXT sz
  175.     'Draw Smile
  176.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
  177.     'Draw Eyes
  178.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  179.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  180.     'hat
  181.     LINE (player.x + camera.x - 10, player.y + camera.y - 10)-(player.x + camera.x + 10, player.y + camera.y - 9), _RGB32(155, 0, 0), BF
  182.     LINE (player.x + camera.x - 5, player.y + camera.y - 9)-(player.x + camera.x + 5, player.y + camera.y - 15), _RGB32(155, 0, 0), BF
  183.     'body
  184.     LINE (player.x + camera.x, player.y + camera.y + 10)-(player.x + camera.x, player.y + camera.y + 20), _RGB32(155, 0, 0)
  185.  
  186.     IF t > 7 THEN t = 0
  187.  
  188.     'rest of body
  189.     IF t = 0 THEN
  190.         'left arm
  191.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  192.         'right arm
  193.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  194.         'left leg
  195.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  196.         'right leg
  197.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  198.     END IF
  199.  
  200.     IF t = 1 OR t = 7 THEN
  201.         'left arm
  202.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  203.         'right arm
  204.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  205.         'left leg
  206.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  207.         'right leg
  208.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  209.     END IF
  210.  
  211.     IF t = 2 OR t = 6 THEN
  212.         'left arm
  213.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  214.         'right arm
  215.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  216.         'left leg
  217.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  218.         'right leg
  219.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  220.     END IF
  221.  
  222.     IF t = 3 OR t = 5 THEN
  223.         'left arm
  224.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  225.         'right arm
  226.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  227.         'left leg
  228.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  229.         'right leg
  230.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  231.     END IF
  232.  
  233.     IF t = 4 THEN
  234.         'left arm
  235.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  236.         'right arm
  237.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  238.         'left leg
  239.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  240.         'right leg
  241.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  242.     END IF
  243.  
  244.  
  245.     FOR check = -15 TO 15
  246.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN
  247.             _DEST map
  248.             FOR sz = .2 TO 35 STEP .2
  249.                 CIRCLE (player.x + check, player.y + check), sz, _RGB32(127, 255, 127)
  250.             NEXT sz
  251.             GOSUB findgold:
  252.         END IF
  253.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN
  254.             _DEST map
  255.             FOR sz = .2 TO 35 STEP .2
  256.                 CIRCLE (player.x + check, player.y - check), sz, _RGB32(127, 255, 127)
  257.             NEXT sz
  258.             GOSUB findgold:
  259.         END IF
  260.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN
  261.             _DEST map
  262.             FOR sz = .2 TO 35 STEP .2
  263.                 CIRCLE (player.x - check, player.y + check), sz, _RGB32(127, 255, 127)
  264.             NEXT sz
  265.             GOSUB findgold:
  266.         END IF
  267.     NEXT check
  268.     _DISPLAY
  269.     _LIMIT 60
  270.  
  271. findgold:
  272. FOR snd = 400 TO 800 STEP 100
  273.     SOUND snd, .5
  274. NEXT snd
  275. score = score + 100
  276. score$ = STR$(score)
  277. level$ = STR$(level)
  278. _TITLE "Level: " + level$ + "   Score: " + score$
  279. IF score / 2000 = INT(score / 2000) THEN
  280.     level = level + 1
  281.     level$ = STR$(level)
  282.     _TITLE "Level: " + level$ + "   Score: " + score$
  283.     IF level = 21 THEN GOTO win:
  284.     GOTO start2:
  285.  
  286. done:
  287. LOCATE 10, 45: PRINT "G A M E     O V E R"
  288. FOR snd = 450 TO 150 STEP -25
  289.     SOUND snd, .5
  290. NEXT snd
  291. LOCATE 13, 45: PRINT "Again (Y/N)?"
  292. ag:
  293. ag$ = INKEY$
  294. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  295. IF ag$ = "n" OR ag$ = "N" THEN END
  296. GOTO ag:
  297.  
  298. win:
  299. LOCATE 10, 45: PRINT "G A M E     W O N ! ! ! ! ! ! !"
  300. FOR snd = 450 TO 150 STEP -25
  301.     SOUND snd, .5
  302. NEXT snd
  303. LOCATE 13, 45: PRINT "Again (Y/N)?"
  304. ag2:
  305. ag$ = INKEY$
  306. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  307. IF ag$ = "n" OR ag$ = "N" THEN END
  308. GOTO ag2:
  309.  
  310. 'Thanks to FelippeHeitor for this Sub and the camera code above.
  311. SUB adjustCamera
  312.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
  313.         camera.x = _WIDTH / 2 - player.x
  314.     END IF
  315.     IF camera.x > 0 THEN camera.x = 0
  316.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
  317.  
  318.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
  319.         camera.y = _HEIGHT / 2 - player.y
  320.     END IF
  321.     IF camera.y > 0 THEN camera.y = 0
  322.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
  323.  
Find The Gold - game by SierraKen 3.jpg
* Find The Gold - game by SierraKen 3.jpg (Filesize: 82.06 KB, Dimensions: 800x626, Views: 174)
« Last Edit: October 25, 2020, 12:42:53 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Find The Gold!
« Reply #16 on: October 25, 2020, 01:09:20 pm »
Ah tree shapes much better! Can you do heights according to distance away ie the higher up in landscape the smaller the trees? Something to try...

Also do you know how to vary browns and greens? Formula for Brown is 3 parts red + 2 parts green + 1 part Blue
So really really dark brown is _RGB32(30, 20, 10) probably looks black but
60, 40, 20 might serve plus some randomness of course
and tans and beige is like 255, 128, 64 really light,  200, 100, 50 darker...

Greens browned up by adding red and blue grass is made by adding... well blue of course ;-)) but always way less than amount of green.

Hills would get bluer as recede into background because more air and reflecting more sky like lakes and oceans only more subtle because 0 smooth surfaces.
« Last Edit: October 25, 2020, 01:10:54 pm by bplus »

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: Find The Gold!
« Reply #17 on: October 25, 2020, 02:23:12 pm »
The last one looking really good ..
If you can add obstacles then you will made really cool simple game !

https://aurelsoft.ucoz.com/FindGold5.png
« Last Edit: October 25, 2020, 02:24:52 pm by Aurel »
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #18 on: October 25, 2020, 02:26:55 pm »
Awesome! I just used your browns and as you go down further the hills turn more yellow, which also makes it a little harder to find the GOLD as you get down lower. It also looks like the color of the foothills as you get closer. This is way cool! Thanks.

Code: QB64: [Select]
  1. 'Find the Gold! by SierraKen
  2. 'October 24, 2020
  3. 'Thanks for the great mapping code by FellipeHeitor and help from B+!
  4. 'Additions:
  5. 'Body, Arms, and Legs. Levels and 20 gold per level. Larger land area sizes. Lakes and Trees. 20 Level limit.
  6. 'Changed PAINT to CLS , _RGB32(0,200,0) which greatly improves the loading speed.
  7. 'Added 4 times the amount of trees and made 3 levels of mountains.
  8. 'Added random creeks. Added twice the lakes with random shapes.
  9. 'Changed screen size to 800 x 600 to be compatible with all players.
  10. 'Added 100 seconds to level time, to 400 for level 1.
  11. 'Slowed player speed from 10 to 8.
  12. 'Changed to a happier sound when getting gold.
  13. 'Changed color after you get the gold from brown to green.
  14. 'Added WASD keys to move player along with arrow keys.
  15. 'Removed the square mountains and made more realistic hills.
  16. 'Put the lakes on the ground, before everything else.
  17. 'Made trees look better.
  18. 'Removed creeks.
  19. 'Fixed Title Bar.
  20. 'Changed colors of hills.
  21.  
  22. SCREEN _NEWIMAGE(800, 600, 32)
  23.  
  24. TYPE object
  25.     x AS SINGLE
  26.     y AS SINGLE
  27.  
  28. DIM SHARED player AS object
  29. DIM SHARED camera AS object
  30. DIM playerSpeed AS SINGLE
  31.  
  32. _TITLE "Loading....."
  33.  
  34. start:
  35. score = 0
  36. level = 1
  37.  
  38. start2:
  39. player.x = _WIDTH / 2
  40. player.y = _HEIGHT / 2
  41.  
  42. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
  43.  
  44. _DEST map
  45.  
  46. CLS , _RGB32(0, 200, 0)
  47. _LIMIT 2000
  48.  
  49. 'Lakes
  50. FOR lakes = 1 TO 100
  51.     w = RND
  52.     h = RND
  53.     sze = (RND * 250) + 100
  54.     shape = RND
  55.     FOR sz = .25 TO sze STEP .25
  56.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 128, 255), , , shape
  57.     NEXT sz
  58. NEXT lakes
  59.  
  60.  
  61. 'Hills
  62. FOR hills = 1 TO 1200
  63.     xx = (RND * _WIDTH)
  64.     sz = INT(RND * 100) + 200
  65.     shape = RND
  66.     hillcolors:
  67.     blue = blue + .05
  68.     c3 = INT(RND * 50) + 20 + blue
  69.     c2 = c3 * 2
  70.     c1 = c3 * 3
  71.     IF c1 = 255 AND c2 = 255 AND c3 = 128 THEN GOTO hillcolors:
  72.     yy = yy + 4
  73.     FOR hill = 1 TO sz STEP .25
  74.         hh = hh + .025
  75.         IF hh > 100 THEN hh = 100
  76.         cc1 = c1 + hh
  77.         cc2 = c2 + hh
  78.         cc3 = c3 + hh
  79.         CIRCLE (xx, yy), hill, _RGB32(cc1, cc2, cc3), 2 * _PI, _PI, shape
  80.     NEXT hill
  81.     hh = 0
  82. NEXT hills
  83. blue = 0
  84. yy = 0
  85.  
  86.  
  87. 'Trees
  88. FOR trees = 1 TO 1000
  89.     tx = RND
  90.     tx = tx * _WIDTH
  91.     ty = RND
  92.     ty = ty * _HEIGHT
  93.     tsz = (RND * 40) + 10
  94.     LINE (tx, ty)-(tx, ty + tsz + 5), _RGB32(188, 127, 127)
  95.     FOR branches = ty TO ty + tsz STEP 3
  96.         trim = trim + 2
  97.         LINE (tx, branches)-(tx - trim, branches + 5), _RGB32(0, 183, 127)
  98.         LINE (tx, branches)-(tx + trim, branches + 5), _RGB32(0, 183, 127)
  99.     NEXT branches
  100.     trim = 0
  101. NEXT trees
  102.  
  103. 'Place Gold
  104. FOR gold = 1 TO 20
  105.     gold:
  106.     w2 = INT(RND * _WIDTH) - 40
  107.     h2 = INT(RND * _HEIGHT) - 40
  108.     IF w2 < 40 THEN w2 = 40
  109.     IF h2 < 40 THEN h2 = 40
  110.     IF POINT(w2, h2) = _RGB32(255, 255, 128) THEN GOTO gold:
  111.     IF POINT(w2, h2) = _RGB32(0, 0, 0) THEN GOTO gold:
  112.     'Gold
  113.     COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
  114.     _PRINTSTRING (w2, h2), "GOLD"
  115. NEXT gold
  116.  
  117.  
  118.  
  119. playerSpeed = 8
  120.  
  121. CONST keyUP = 18432
  122. CONST keyDOWN = 20480
  123. CONST keyLEFT = 19200
  124. CONST keyRIGHT = 19712
  125. CONST keyESC = 27
  126. _PUTIMAGE (camera.x, camera.y), map
  127.  
  128. LOCATE 3, 30: PRINT "Use the arrow keys (or WASD keys) to find 20 gold bars per level."
  129. LOCATE 4, 30: PRINT "Every level will have a shorter time."
  130. LOCATE 5, 30: PRINT "After Level 20 you win the game."
  131. LOCATE 10, 40: PRINT "Press Any Key To Begin."
  132. _TITLE "Find The Gold!"
  133. pause:
  134. a$ = INKEY$
  135. IF a$ <> "" THEN GOTO begin:
  136. GOTO pause:
  137. score$ = STR$(score)
  138. level$ = STR$(level)
  139.  
  140.  
  141. begin:
  142. _TITLE "Level: " + level$ + "   Score: " + score$
  143. seconds = INT(TIMER)
  144.     CLS
  145.     leveltime = level * 5
  146.     gametime = (405 - leveltime) - (INT(TIMER) - seconds)
  147.     _PUTIMAGE (camera.x, camera.y), map
  148.     LOCATE 1, 1: PRINT "Time Left: "; gametime
  149.     IF gametime < 1 THEN GOTO done:
  150.     IF _KEYDOWN(keyUP) OR _KEYDOWN(119) THEN
  151.         player.y = player.y - playerSpeed
  152.         t = t + 1
  153.     END IF
  154.     IF _KEYDOWN(keyDOWN) OR _KEYDOWN(115) THEN
  155.         player.y = player.y + playerSpeed
  156.         t = t + 1
  157.     END IF
  158.     IF _KEYDOWN(keyLEFT) OR _KEYDOWN(97) THEN
  159.         player.x = player.x - playerSpeed
  160.         t = t + 1
  161.     END IF
  162.     IF _KEYDOWN(keyRIGHT) OR _KEYDOWN(100) THEN
  163.         player.x = player.x + playerSpeed
  164.         t = t + 1
  165.     END IF
  166.     IF _KEYDOWN(keyESC) THEN END
  167.     IF player.x < 0 THEN player.x = 0
  168.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
  169.     IF player.y < 0 THEN player.y = 0
  170.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
  171.  
  172.     adjustCamera
  173.  
  174.     'Draw Head
  175.     FOR sz = .25 TO 10 STEP .25
  176.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
  177.     NEXT sz
  178.     'Draw Smile
  179.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
  180.     'Draw Eyes
  181.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  182.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  183.     'hat
  184.     LINE (player.x + camera.x - 10, player.y + camera.y - 10)-(player.x + camera.x + 10, player.y + camera.y - 9), _RGB32(155, 0, 0), BF
  185.     LINE (player.x + camera.x - 5, player.y + camera.y - 9)-(player.x + camera.x + 5, player.y + camera.y - 15), _RGB32(155, 0, 0), BF
  186.     'body
  187.     LINE (player.x + camera.x, player.y + camera.y + 10)-(player.x + camera.x, player.y + camera.y + 20), _RGB32(155, 0, 0)
  188.  
  189.     IF t > 7 THEN t = 0
  190.  
  191.     'rest of body
  192.     IF t = 0 THEN
  193.         'left arm
  194.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  195.         'right arm
  196.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  197.         'left leg
  198.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  199.         'right leg
  200.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  201.     END IF
  202.  
  203.     IF t = 1 OR t = 7 THEN
  204.         'left arm
  205.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  206.         'right arm
  207.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  208.         'left leg
  209.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  210.         'right leg
  211.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  212.     END IF
  213.  
  214.     IF t = 2 OR t = 6 THEN
  215.         'left arm
  216.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  217.         'right arm
  218.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  219.         'left leg
  220.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  221.         'right leg
  222.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  223.     END IF
  224.  
  225.     IF t = 3 OR t = 5 THEN
  226.         'left arm
  227.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  228.         'right arm
  229.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  230.         'left leg
  231.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  232.         'right leg
  233.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  234.     END IF
  235.  
  236.     IF t = 4 THEN
  237.         'left arm
  238.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  239.         'right arm
  240.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  241.         'left leg
  242.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  243.         'right leg
  244.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  245.     END IF
  246.  
  247.  
  248.     FOR check = -15 TO 15
  249.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN
  250.             _DEST map
  251.             FOR sz = .2 TO 35 STEP .2
  252.                 CIRCLE (player.x + check, player.y + check), sz, _RGB32(127, 255, 127)
  253.             NEXT sz
  254.             GOSUB findgold:
  255.         END IF
  256.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN
  257.             _DEST map
  258.             FOR sz = .2 TO 35 STEP .2
  259.                 CIRCLE (player.x + check, player.y - check), sz, _RGB32(127, 255, 127)
  260.             NEXT sz
  261.             GOSUB findgold:
  262.         END IF
  263.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN
  264.             _DEST map
  265.             FOR sz = .2 TO 35 STEP .2
  266.                 CIRCLE (player.x - check, player.y + check), sz, _RGB32(127, 255, 127)
  267.             NEXT sz
  268.             GOSUB findgold:
  269.         END IF
  270.     NEXT check
  271.     _DISPLAY
  272.     _LIMIT 60
  273.  
  274. findgold:
  275. FOR snd = 400 TO 800 STEP 100
  276.     SOUND snd, .5
  277. NEXT snd
  278. score = score + 100
  279. score$ = STR$(score)
  280. level$ = STR$(level)
  281. _TITLE "Level: " + level$ + "   Score: " + score$
  282. IF score / 2000 = INT(score / 2000) THEN
  283.     level = level + 1
  284.     level$ = STR$(level)
  285.     _TITLE "Level: " + level$ + "   Score: " + score$
  286.     IF level = 21 THEN GOTO win:
  287.     GOTO start2:
  288.  
  289. done:
  290. LOCATE 10, 45: PRINT "G A M E     O V E R"
  291. FOR snd = 450 TO 150 STEP -25
  292.     SOUND snd, .5
  293. NEXT snd
  294. LOCATE 13, 45: PRINT "Again (Y/N)?"
  295. ag:
  296. ag$ = INKEY$
  297. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  298. IF ag$ = "n" OR ag$ = "N" THEN END
  299. GOTO ag:
  300.  
  301. win:
  302. LOCATE 10, 45: PRINT "G A M E     W O N ! ! ! ! ! ! !"
  303. FOR snd = 450 TO 150 STEP -25
  304.     SOUND snd, .5
  305. NEXT snd
  306. LOCATE 13, 45: PRINT "Again (Y/N)?"
  307. ag2:
  308. ag$ = INKEY$
  309. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  310. IF ag$ = "n" OR ag$ = "N" THEN END
  311. GOTO ag2:
  312.  
  313. 'Thanks to FelippeHeitor for this Sub and the camera code above.
  314. SUB adjustCamera
  315.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
  316.         camera.x = _WIDTH / 2 - player.x
  317.     END IF
  318.     IF camera.x > 0 THEN camera.x = 0
  319.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
  320.  
  321.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
  322.         camera.y = _HEIGHT / 2 - player.y
  323.     END IF
  324.     IF camera.y > 0 THEN camera.y = 0
  325.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
  326.  
Find The Gold - game by SierraKen 4.jpg
* Find The Gold - game by SierraKen 4.jpg (Filesize: 96.55 KB, Dimensions: 797x625, Views: 152)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #19 on: October 25, 2020, 02:28:04 pm »
Aurel, that sounds like a great idea! I'll work on that toward the end of the week when my power comes back.

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: Find The Gold!
« Reply #20 on: October 25, 2020, 02:35:59 pm »
Fine ...just take your time ..
oups i add link then i figured that i can use attachment ...hmmm
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #21 on: October 26, 2020, 05:40:38 pm »
My power didn't go out after all so I've been working hard on this game today. I added mine shafts where if you run into one, it sends you to a random place on the map. And as you get high in the levels, more mine shafts are there to dodge. I reduced the 20 levels to win to 10 levels and added my own music I made many years ago. It was a program called Magix Music Creator on my old Windows XP computer. So I put that music file and the game in a zip file below in attachments. Enjoy and tell me what you think, thanks.

* Find The Gold.zip (Filesize: 2.71 MB, Downloads: 132)

FellippeHeitor

  • Guest
Re: Find The Gold!
« Reply #22 on: October 26, 2020, 05:45:44 pm »
This is progressing nicely, Ken!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #23 on: October 26, 2020, 06:56:34 pm »
Thanks Felippe. :) Next I might add some enemies and lives but we'll see. I like tinkering around with it. :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Find The Gold!
« Reply #24 on: October 27, 2020, 11:02:32 am »
Yes, I like music, coordinates and mountain coloring: light towards front or down and darker bluer upwards to top.

The mountain coloring helps with visual bearings, maybe could go flat-lands and housing on left or right to help as visual clues where you are on map.

What would be really clever is thumbnail sketch were you've been on map.


Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #25 on: October 27, 2020, 05:46:30 pm »
Thanks for the ideas B+. I added 10 houses per level. I also added 5 extra gold bars per level to make it a little easier. You just need to get 20 to pass each level. I also added a map in the lower right-hand corner of the screen, which was pretty tricky but I figured it out. :) The gold dots are where the gold is located and you are the red dot. Since I use POINT in almost everything and not specific variable coordinates as you collect the gold, I wasn't able to make the gold dots disappear when you collect them. But I still like what I did.
The updated code is below and I also updated the zip file in the attachment below that includes the background music. I hope you all enjoy this. This will probably be the final version since I need a break on it. Maybe someday I'll come back and add more things. But for now, this is good. Below is a current photo.

Code: QB64: [Select]
  1. 'Find the Gold! by SierraKen
  2. 'October 27, 2020
  3. 'Thanks for the great mapping code by FellipeHeitor and help from B+ and ideas from Aurel!
  4. 'Newest Additions: Mine Shafts and Music.
  5. 'Music created by me many years ago.
  6. 'Added random houses on each level.
  7. 'Added 5 extra gold bars on each level.
  8. 'Added Map in lower right corner.
  9.  
  10. SCREEN _NEWIMAGE(800, 600, 32)
  11.  
  12. TYPE object
  13.     x AS SINGLE
  14.     y AS SINGLE
  15.  
  16. DIM SHARED player AS object
  17. DIM SHARED camera AS object
  18. DIM playerSpeed AS SINGLE
  19. DIM minelevel AS SINGLE
  20. DIM level AS SINGLE
  21. DIM score AS SINGLE
  22. DIM leveltime AS SINGLE
  23. DIM gametime AS SINGLE
  24. DIM seconds AS SINGLE
  25. DIM goldx(50), goldy(50)
  26.  
  27. _TITLE "Loading....."
  28. s& = _SNDOPEN("Hello_Martian_Home.mp3")
  29. start:
  30. minelevel = 50
  31. score = 0
  32. level = 1
  33.  
  34. start2:
  35. player.x = _WIDTH / 2
  36. player.y = _HEIGHT / 2
  37.  
  38. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
  39.  
  40. _DEST map
  41.  
  42. CLS , _RGB32(0, 200, 0)
  43. _LIMIT 2000
  44.  
  45. 'Lakes
  46. FOR lakes = 1 TO 100
  47.     w = RND
  48.     h = RND
  49.     sze = (RND * 250) + 100
  50.     shape = RND
  51.     FOR sz = .25 TO sze STEP .25
  52.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 128, 255), , , shape
  53.     NEXT sz
  54. NEXT lakes
  55.  
  56. 'Hills
  57. FOR hills = 1 TO 1200
  58.     xx = (RND * _WIDTH)
  59.     sz = INT(RND * 100) + 200
  60.     shape = RND
  61.     hillcolors:
  62.     blue = blue + .05
  63.     c3 = INT(RND * 50) + 20 + blue
  64.     c2 = c3 * 2
  65.     c1 = c3 * 3
  66.     IF c1 = 255 AND c2 = 255 AND c3 = 128 THEN GOTO hillcolors:
  67.     yy = yy + 4
  68.     FOR hill = 1 TO sz STEP .25
  69.         hh = hh + .025
  70.         IF hh > 100 THEN hh = 100
  71.         cc1 = c1 + hh
  72.         cc2 = c2 + hh
  73.         cc3 = c3 + hh
  74.         CIRCLE (xx, yy), hill, _RGB32(cc1, cc2, cc3), 2 * _PI, _PI, shape
  75.     NEXT hill
  76.     hh = 0
  77. NEXT hills
  78. blue = 0
  79. yy = 0
  80.  
  81. 'Trees
  82. FOR trees = 1 TO 1000
  83.     tx = RND
  84.     tx = tx * _WIDTH
  85.     ty = RND
  86.     ty = ty * _HEIGHT
  87.     tsz = (RND * 40) + 10
  88.     LINE (tx, ty)-(tx, ty + tsz + 5), _RGB32(188, 127, 127)
  89.     FOR branches = ty TO ty + tsz STEP 3
  90.         trim = trim + 2
  91.         LINE (tx, branches)-(tx - trim, branches + 5), _RGB32(0, 183, 127)
  92.         LINE (tx, branches)-(tx + trim, branches + 5), _RGB32(0, 183, 127)
  93.     NEXT branches
  94.     trim = 0
  95. NEXT trees
  96.  
  97. 'Mine Shafts
  98. FOR mines = 1 TO minelevel
  99.     mines:
  100.     bx = RND
  101.     bx = bx * _WIDTH
  102.     by = RND
  103.     by = by * _HEIGHT
  104.     IF bx < 500 AND by < 400 THEN GOTO mines:
  105.     FOR sz = .25 TO 10 STEP .25
  106.         CIRCLE (bx, by), sz, _RGB32(0, 0, 5)
  107.     NEXT sz
  108. NEXT mines
  109.  
  110. 'Houses
  111. FOR houses = 1 TO 10
  112.     xhouse = INT(RND * _WIDTH)
  113.     yhouse = INT(RND * _HEIGHT)
  114.     szhouse = INT(RND * 60) + 30
  115.     LINE (xhouse, yhouse)-(xhouse + szhouse, yhouse + szhouse), _RGB32(183, 161, 150), BF
  116.     'roof
  117.     FOR sz = .25 TO (szhouse / 2) STEP .25
  118.         CIRCLE (xhouse + (szhouse / 2), yhouse), sz, _RGB32(150, 105, 105), _PI * 2, _PI, .5
  119.     NEXT sz
  120.     'door
  121.     LINE (xhouse + (szhouse / 2) - szhouse * .1, yhouse + szhouse - 15)-(xhouse + (szhouse / 2) + szhouse * .1, yhouse + szhouse), _RGB32(150, 105, 105), BF
  122.     'windows
  123.     LINE (xhouse + szhouse * .2, yhouse + szhouse * .2)-(xhouse + szhouse * .4, yhouse + szhouse * .4), _RGB32(150, 105, 105), BF
  124.     LINE (xhouse + szhouse * .6, yhouse + szhouse * .2)-(xhouse + szhouse * .8, yhouse + szhouse * .4), _RGB32(150, 105, 105), BF
  125. NEXT houses
  126.  
  127.  
  128. 'Place Gold
  129. FOR gold = 1 TO 25
  130.     gold:
  131.     w2 = INT(RND * _WIDTH) - 40
  132.     h2 = INT(RND * _HEIGHT) - 40
  133.     goldx(gold) = w2
  134.     goldy(gold) = h2
  135.     IF w2 < 40 THEN w2 = 40
  136.     IF h2 < 40 THEN h2 = 40
  137.     IF h2 > (_HEIGHT - 150) THEN GOTO gold:
  138.     IF POINT(w2, h2) = _RGB32(255, 255, 128) THEN GOTO gold:
  139.     IF POINT(w2, h2) = _RGB32(0, 0, 0) THEN GOTO gold:
  140.     IF POINT(w2, h2) = _RGB32(0, 0, 5) THEN GOTO gold:
  141.     FOR check = -10 TO 10
  142.         IF POINT(w2 + check, h2 + check) = _RGB32(183, 161, 150) THEN GOTO gold:
  143.         IF POINT(w2 + check, h2 + check) = _RGB32(150, 105, 105) THEN GOTO gold:
  144.     NEXT check
  145.     'Gold
  146.     COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
  147.     _PRINTSTRING (w2, h2), "GOLD"
  148. NEXT gold
  149.  
  150.  
  151.  
  152. IF level > 1 THEN GOTO begin:
  153.  
  154. playerSpeed = 8
  155.  
  156. CONST keyUP = 18432
  157. CONST keyDOWN = 20480
  158. CONST keyLEFT = 19200
  159. CONST keyRIGHT = 19712
  160. CONST keyESC = 27
  161. _PUTIMAGE (camera.x, camera.y), map
  162.  
  163. LOCATE 3, 22: PRINT "Use the arrow keys (or WASD keys) to find 20 gold bars per level."
  164. LOCATE 4, 22: PRINT "To make it a little easier, there are 25 gold bars on each level."
  165. LOCATE 5, 22: PRINT "Every level will have a shorter time."
  166. LOCATE 6, 22: PRINT "After Level 10 you win the game."
  167. LOCATE 7, 22: PRINT "Be careful not to step in the black mine shafts or they will send"
  168. LOCATE 8, 22: PRINT "you to a random location."
  169. LOCATE 9, 22: PRINT "Every level will have more mine shafts."
  170. LOCATE 10, 22: PRINT "Use the Map in the lower right corner to see where the gold is placed."
  171. LOCATE 11, 22: PRINT "Map will not remove gold dot after you have picked it up."
  172. LOCATE 12, 22: PRINT "You show up on the map as a red dot."
  173. LOCATE 14, 22: PRINT "Game and Music created by SierraKen."
  174. LOCATE 17, 32: PRINT "* Press Any Key To Begin. *"
  175. _TITLE "Find The Gold!"
  176. pause:
  177. a$ = INKEY$
  178. IF a$ <> "" THEN GOTO begin:
  179. GOTO pause:
  180.  
  181. begin:
  182. score$ = STR$(score)
  183. level$ = STR$(level)
  184. _TITLE "Level: " + level$ + "   Score: " + score$
  185. seconds = INT(TIMER)
  186.     CLS
  187.     leveltime = level * 10
  188.     gametime = (410 - leveltime) - (INT(TIMER) - seconds)
  189.     _PUTIMAGE (camera.x, camera.y), map
  190.     LOCATE 1, 1: PRINT "Time Left: "; gametime
  191.     IF gametime < 1 THEN GOTO done:
  192.     IF _KEYDOWN(keyUP) OR _KEYDOWN(119) THEN
  193.         player.y = player.y - playerSpeed
  194.         t = t + 1
  195.         score$ = STR$(score)
  196.         level$ = STR$(level)
  197.         coordx$ = STR$(player.x)
  198.         coordy$ = STR$(player.y)
  199.         _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  200.     END IF
  201.     IF _KEYDOWN(keyDOWN) OR _KEYDOWN(115) THEN
  202.         player.y = player.y + playerSpeed
  203.         t = t + 1
  204.         score$ = STR$(score)
  205.         level$ = STR$(level)
  206.         coordx$ = STR$(player.x)
  207.         coordy$ = STR$(player.y)
  208.         _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  209.     END IF
  210.     IF _KEYDOWN(keyLEFT) OR _KEYDOWN(97) THEN
  211.         player.x = player.x - playerSpeed
  212.         t = t + 1
  213.         score$ = STR$(score)
  214.         level$ = STR$(level)
  215.         coordx$ = STR$(player.x)
  216.         coordy$ = STR$(player.y)
  217.         _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  218.     END IF
  219.     IF _KEYDOWN(keyRIGHT) OR _KEYDOWN(100) THEN
  220.         player.x = player.x + playerSpeed
  221.         t = t + 1
  222.         score$ = STR$(score)
  223.         level$ = STR$(level)
  224.         coordx$ = STR$(player.x)
  225.         coordy$ = STR$(player.y)
  226.         _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  227.     END IF
  228.     IF _KEYDOWN(keyESC) THEN END
  229.     IF player.x < 0 THEN player.x = 0
  230.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
  231.     IF player.y < 0 THEN player.y = 0
  232.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
  233.  
  234.     adjustCamera
  235.  
  236.     'Draw Head
  237.     FOR sz = .25 TO 10 STEP .25
  238.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
  239.     NEXT sz
  240.     'Draw Smile
  241.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
  242.     'Draw Eyes
  243.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  244.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
  245.     'hat
  246.     LINE (player.x + camera.x - 10, player.y + camera.y - 10)-(player.x + camera.x + 10, player.y + camera.y - 9), _RGB32(155, 0, 0), BF
  247.     LINE (player.x + camera.x - 5, player.y + camera.y - 9)-(player.x + camera.x + 5, player.y + camera.y - 15), _RGB32(155, 0, 0), BF
  248.     'body
  249.     LINE (player.x + camera.x, player.y + camera.y + 10)-(player.x + camera.x, player.y + camera.y + 20), _RGB32(155, 0, 0)
  250.  
  251.     IF t > 7 THEN t = 0
  252.  
  253.     'rest of body
  254.     IF t = 0 THEN
  255.         'left arm
  256.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  257.         'right arm
  258.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 15, player.y + camera.y + 25), _RGB32(155, 0, 0)
  259.         'left leg
  260.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  261.         'right leg
  262.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 15, player.y + camera.y + 35), _RGB32(155, 0, 0)
  263.     END IF
  264.  
  265.     IF t = 1 OR t = 7 THEN
  266.         'left arm
  267.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  268.         'right arm
  269.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 11, player.y + camera.y + 25), _RGB32(155, 0, 0)
  270.         'left leg
  271.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  272.         'right leg
  273.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 11, player.y + camera.y + 35), _RGB32(155, 0, 0)
  274.     END IF
  275.  
  276.     IF t = 2 OR t = 6 THEN
  277.         'left arm
  278.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  279.         'right arm
  280.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 9, player.y + camera.y + 24), _RGB32(155, 0, 0)
  281.         'left leg
  282.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  283.         'right leg
  284.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 9, player.y + camera.y + 35), _RGB32(155, 0, 0)
  285.     END IF
  286.  
  287.     IF t = 3 OR t = 5 THEN
  288.         'left arm
  289.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  290.         'right arm
  291.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 7, player.y + camera.y + 24), _RGB32(155, 0, 0)
  292.         'left leg
  293.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  294.         'right leg
  295.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 7, player.y + camera.y + 35), _RGB32(155, 0, 0)
  296.     END IF
  297.  
  298.     IF t = 4 THEN
  299.         'left arm
  300.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x - 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  301.         'right arm
  302.         LINE (player.x + camera.x, player.y + camera.y + 13)-(player.x + camera.x + 5, player.y + camera.y + 23), _RGB32(155, 0, 0)
  303.         'left leg
  304.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x - 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  305.         'right leg
  306.         LINE (player.x + camera.x, player.y + camera.y + 20)-(player.x + camera.x + 5, player.y + camera.y + 35), _RGB32(155, 0, 0)
  307.     END IF
  308.  
  309.     FOR check = -15 TO 15
  310.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN
  311.             _DEST map
  312.             FOR sz = .2 TO 35 STEP .2
  313.                 CIRCLE (player.x + check, player.y + check), sz, _RGB32(127, 255, 127)
  314.             NEXT sz
  315.             GOSUB findgold:
  316.         END IF
  317.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN
  318.             _DEST map
  319.             FOR sz = .2 TO 35 STEP .2
  320.                 CIRCLE (player.x + check, player.y - check), sz, _RGB32(127, 255, 127)
  321.             NEXT sz
  322.             GOSUB findgold:
  323.         END IF
  324.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN
  325.             _DEST map
  326.             FOR sz = .2 TO 35 STEP .2
  327.                 CIRCLE (player.x - check, player.y + check), sz, _RGB32(127, 255, 127)
  328.             NEXT sz
  329.             GOSUB findgold:
  330.         END IF
  331.     NEXT check
  332.  
  333.     FOR checkmines = -5 TO 5
  334.         IF POINT(player.x + checkmines, player.y + checkmines) = _RGB32(0, 0, 5) THEN
  335.             _DEST map
  336.             FOR sz = .25 TO 35 STEP .25
  337.                 CIRCLE (player.x + checkmines, player.y + checkmines), sz, _RGB32(127, 127, 127)
  338.             NEXT sz
  339.             FOR sz = 1 TO 35 STEP 5
  340.                 CIRCLE (player.x + checkmines, player.y + checkmines), sz, _RGB32(127, 0, 0)
  341.                 SOUND 150 + (sz * 3), 1
  342.                 _DELAY .05
  343.             NEXT sz
  344.             player.x = INT(_WIDTH(map) * RND)
  345.             player.y = INT(_HEIGHT(map) * RND)
  346.             score$ = STR$(score)
  347.             level$ = STR$(level)
  348.             coordx$ = STR$(player.x)
  349.             coordy$ = STR$(player.y)
  350.             _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  351.             _DEST 0
  352.             GOTO nex:
  353.         END IF
  354.         IF POINT(player.x + checkmines, player.y - checkmines) = _RGB32(0, 0, 5) THEN
  355.             _DEST map
  356.             FOR sz = .25 TO 35 STEP .25
  357.                 CIRCLE (player.x + checkmines, player.y - checkmines), sz, _RGB32(127, 127, 127)
  358.             NEXT sz
  359.             FOR sz = 1 TO 35 STEP 5
  360.                 CIRCLE (player.x + checkmines, player.y - checkmines), sz, _RGB32(127, 0, 0)
  361.                 SOUND 150 + (sz * 3), 1
  362.                 _DELAY .05
  363.             NEXT sz
  364.             player.x = INT(_WIDTH(map) * RND)
  365.             player.y = INT(_HEIGHT(map) * RND)
  366.             score$ = STR$(score)
  367.             level$ = STR$(level)
  368.             coordx$ = STR$(player.x)
  369.             coordy$ = STR$(player.y)
  370.             _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  371.             _DEST 0
  372.             GOTO nex:
  373.         END IF
  374.         IF POINT(player.x - checkmines, player.y + checkmines) = _RGB32(0, 0, 5) THEN
  375.             _DEST map
  376.             FOR sz = .25 TO 35 STEP .25
  377.                 CIRCLE (player.x - checkmines, player.y + checkmines), sz, _RGB32(127, 127, 127)
  378.             NEXT sz
  379.             FOR sz = 1 TO 35 STEP 5
  380.                 CIRCLE (player.x - checkmines, player.y + checkmines), sz, _RGB32(127, 0, 0)
  381.                 SOUND 150 + (sz * 3), 1
  382.                 _DELAY .05
  383.             NEXT sz
  384.             player.x = INT(_WIDTH(map) * RND)
  385.             player.y = INT(_HEIGHT(map) * RND)
  386.             score$ = STR$(score)
  387.             level$ = STR$(level)
  388.             coordx$ = STR$(player.x)
  389.             coordy$ = STR$(player.y)
  390.             _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  391.             _DEST 0
  392.             GOTO nex:
  393.         END IF
  394.     NEXT checkmines
  395.     nex:
  396.  
  397.     'Map
  398.     radarx1 = (_WIDTH + 735) - _WIDTH
  399.     radary1 = (_HEIGHT + 535) - _HEIGHT
  400.     radarx2 = (_WIDTH + 785) - _WIDTH
  401.     radary2 = (_HEIGHT + 585) - _HEIGHT
  402.     LINE (radarx1, radary1)-(radarx2, radary2), _RGB32(0, 0, 0), BF
  403.     xradar = player.x / 112: yradar = player.y / 84
  404.     FOR sz = .25 TO 2 STEP .25
  405.         CIRCLE ((radarx1 + xradar), (radary1 + yradar)), sz, _RGB32(255, 0, 0)
  406.     NEXT sz
  407.     FOR gold2 = 1 TO 25
  408.         xgold = goldx(gold2) / 112: ygold = goldy(gold2) / 84
  409.         FOR sz = .25 TO 1 STEP .25
  410.             CIRCLE ((radarx1 + xgold), (radary1 + ygold)), sz, _RGB32(255, 255, 0)
  411.         NEXT sz
  412.     NEXT gold2
  413.  
  414.     _DISPLAY
  415.     _LIMIT 60
  416.  
  417. findgold:
  418. FOR snd = 400 TO 800 STEP 100
  419.     SOUND snd, .5
  420. NEXT snd
  421. score = score + 100
  422. score$ = STR$(score)
  423. level$ = STR$(level)
  424. coordx$ = STR$(player.x)
  425. coordy$ = STR$(player.y)
  426. _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  427. IF score / 2000 = INT(score / 2000) THEN
  428.     level = level + 1
  429.     minelevel = minelevel + 50
  430.     level$ = STR$(level)
  431.     coordx$ = STR$(player.x)
  432.     coordy$ = STR$(player.y)
  433.     _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  434.     IF level = 11 THEN GOTO win:
  435.     GOTO start2:
  436.  
  437. done:
  438. LOCATE 10, 45: PRINT "G A M E     O V E R"
  439. FOR snd = 450 TO 150 STEP -25
  440.     SOUND snd, .5
  441. NEXT snd
  442. LOCATE 13, 45: PRINT "Again (Y/N)?"
  443. ag:
  444. ag$ = INKEY$
  445. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  446. IF ag$ = "n" OR ag$ = "N" THEN END
  447. GOTO ag:
  448.  
  449. win:
  450. level = 10
  451. level$ = STR$(level)
  452. _TITLE "Level: " + level$ + "   Score: " + score$ + "                         Coordinates: " + coordx$ + "," + coordy$
  453. LOCATE 10, 45: PRINT "G A M E     W O N ! ! ! ! ! ! !"
  454. FOR snd = 450 TO 150 STEP -25
  455.     SOUND snd, .5
  456. NEXT snd
  457. LOCATE 13, 45: PRINT "Again (Y/N)?"
  458. ag2:
  459. ag$ = INKEY$
  460. IF ag$ = "y" OR ag$ = "Y" THEN GOTO start:
  461. IF ag$ = "n" OR ag$ = "N" THEN END
  462. GOTO ag2:
  463.  
  464. 'Thanks to FelippeHeitor for this Sub and the camera code above.
  465. SUB adjustCamera
  466.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
  467.         camera.x = _WIDTH / 2 - player.x
  468.     END IF
  469.     IF camera.x > 0 THEN camera.x = 0
  470.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
  471.  
  472.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
  473.         camera.y = _HEIGHT / 2 - player.y
  474.     END IF
  475.     IF camera.y > 0 THEN camera.y = 0
  476.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
  477.  





* Find The Gold.zip (Filesize: 2.71 MB, Downloads: 101)
Find The Gold - game by SierraKen 5.jpg
* Find The Gold - game by SierraKen 5.jpg (Filesize: 106.86 KB, Dimensions: 801x625, Views: 84)
« Last Edit: October 27, 2020, 06:20:54 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Find The Gold!
« Reply #26 on: October 27, 2020, 06:20:52 pm »
Oh nice you did get a little thumbnail!  What are the target like things?

You know what I need is a countdown of how many gold bars are left. No rest for the wicked. ;-))
« Last Edit: October 27, 2020, 06:22:14 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #27 on: October 27, 2020, 06:22:14 pm »
LOL I thought about that but I am just so used to counting them with the Score amount. 100 per gold bar. Every 2000 passes a level. But I'll add it. LOL

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Find The Gold!
« Reply #28 on: October 27, 2020, 06:23:26 pm »
The target-like things? Do you mean the yellow dots in the map? That's where the gold is. You are the red one.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Find The Gold!
« Reply #29 on: October 27, 2020, 06:23:52 pm »
LOL I thought about that but I am just so used to counting them with the Score amount. 100 per gold bar. Every 2000 passes a level. But I'll add it. LOL

OH OK that is good, go rest :-))