Author Topic: Pretentious not-yet-a-clone clone of Among Us in QB64  (Read 10063 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Pretentious not-really-a-clone clone of Among Us in QB64
« Reply #15 on: October 21, 2020, 05:58:28 pm »
  • Best Answer
  • US (North Carolina).

    Edit: I saw you there.  I just wandered around a while and left.

    - Dav

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #16 on: October 21, 2020, 06:01:35 pm »
  • Best Answer
  • Glad to see you around!

    Offline johnno56

    • Forum Resident
    • Posts: 1270
    • Live long and prosper.
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #17 on: October 21, 2020, 06:41:52 pm »
  • Best Answer
  • This concept (A background larger than the main window) reminded me of the game Agario (homework...) but this method could easily be used for a 'space shooter'. Instead of a circular player; a ship. Instead of random circles; a star-field....

    You did an excellent job in explaining everything... even 'I' could understand it... lol

    Well done!
    Logic is the beginning of wisdom.

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #18 on: October 21, 2020, 10:07:18 pm »
  • Best Answer
  • Felippe, I'm working on a game right now using your code. But I need help detecting colors on the map. I can't seem to figure out the coordinates to use with the POINT command when your guy goes over a certain color. I have deleted my attempts at the code. I've even tried specific variable detection but the problem is, the camera variable goes into negative numbers and the player.x and player.y variables only change when the map stops moving and your guy moves. I'm not sure what to use. Here is the game I have so far. You have to find the GOLD bar and then I want it to go to the next level. Instead of all circles I use filled-in squares and blue circular lakes. Plus I made the map 8x so it's fairly big. It might take a couple of seconds to load from the black screen. I'm using your first code you posted on this thread, not the one with Internet access.

    Code: QB64: [Select]
    1.  
    2. SCREEN _NEWIMAGE(1000, 800, 32)
    3.  
    4. TYPE object
    5.     x AS SINGLE
    6.     y AS SINGLE
    7.  
    8. DIM SHARED player AS object
    9. DIM SHARED camera AS object
    10. DIM playerSpeed AS SINGLE
    11.  
    12. start:
    13. player.x = _WIDTH / 2
    14. player.y = _HEIGHT / 2
    15.  
    16. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
    17. _DEST map
    18. PAINT (2, 2), _RGB32(0, 200, 0)
    19.  
    20. FOR blocks = 1 TO 400
    21.     blocks:
    22.     xx = (RND * _WIDTH)
    23.     yy = (RND * _HEIGHT)
    24.     sz = INT(RND * 50) + 10
    25.     c1 = INT(RND * 155) + 100
    26.     c2 = INT(RND * 155) + 100
    27.     c3 = INT(RND * 155) + 100
    28.     LINE (xx, yy)-(xx + sz, yy + sz), _RGB32(c1, c2, c3), BF
    29.     IF POINT(_WIDTH / 2, _HEIGHT / 2) = _RGB32(c1, c2, c3) THEN GOTO blocks:
    30. FOR lakes = 1 TO 10
    31.     w = RND
    32.     h = RND
    33.     sze = (RND * 150) + 50
    34.     FOR sz = .25 TO sze STEP .25
    35.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 0, 255)
    36.     NEXT sz
    37. NEXT lakes
    38. w2 = INT(RND * _WIDTH) - 14
    39. h2 = INT(RND * _HEIGHT) - 7
    40.  
    41. 'Gold
    42. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
    43. _PRINTSTRING (w2, h2), "GOLD"
    44.  
    45.  
    46. playerSpeed = 5
    47.  
    48. CONST keyUP = 18432
    49. CONST keyDOWN = 20480
    50. CONST keyLEFT = 19200
    51. CONST keyRIGHT = 19712
    52.  
    53.     CLS
    54.  
    55.     _PUTIMAGE (camera.x, camera.y), map
    56.  
    57.     IF _KEYDOWN(keyUP) THEN player.y = player.y - playerSpeed
    58.     IF _KEYDOWN(keyDOWN) THEN player.y = player.y + playerSpeed
    59.     IF _KEYDOWN(keyLEFT) THEN player.x = player.x - playerSpeed
    60.     IF _KEYDOWN(keyRIGHT) THEN player.x = player.x + playerSpeed
    61.  
    62.     IF player.x < 0 THEN player.x = 0
    63.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
    64.     IF player.y < 0 THEN player.y = 0
    65.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
    66.  
    67.     adjustCamera
    68.  
    69.     'Draw Head
    70.     FOR sz = .25 TO 10 STEP .25
    71.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
    72.     NEXT sz
    73.     'Draw Smile
    74.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
    75.     'Draw Eyes
    76.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    77.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    78.     'hat
    79.     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
    80.     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
    81.  
    82.  
    83.     _DISPLAY
    84.     _LIMIT 60
    85.  
    86. SUB adjustCamera
    87.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
    88.         camera.x = _WIDTH / 2 - player.x
    89.     END IF
    90.     IF camera.x > 0 THEN camera.x = 0
    91.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
    92.  
    93.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
    94.         camera.y = _HEIGHT / 2 - player.y
    95.     END IF
    96.     IF camera.y > 0 THEN camera.y = 0
    97.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
    98.  

    Offline bplus

    • Global Moderator
    • Forum Resident
    • Posts: 8053
    • b = b + ...
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #19 on: October 21, 2020, 10:10:31 pm »
  • Best Answer
  • Try setting _SOURCE to image handle before using POINT.

    Oh coordinates should be same as camera + player?
    « Last Edit: October 21, 2020, 10:14:23 pm by bplus »

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #20 on: October 21, 2020, 10:14:01 pm »
  • Best Answer
  • In your case, like bplus said, you will need to set _SOURCE first:

    Code: QB64: [Select]

    This way you can read its pixels with POINT().

    Since your player will roam around the map, you will use player.x and player.y to read POINT with, you can ignore the camera variable.

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #21 on: October 21, 2020, 10:54:18 pm »
  • Best Answer
  • I did it!!! Thanks guys!!!

    This is an example game, which is my first mapped out game like this. I hope to expand it sometime soon and make it more fun. For now, you can move your cowboy around and find one gold bar per map. When you move your guy next to or on the bar, it gives you 100 points and starts over with a brand new map. If I expand on this game, I'll make a new forum thread for it. But this is what I have so far. I also doubled the cowboy speed from my last post. Oh also, the gold bar is labeled "GOLD" so you know what it is.

    Code: QB64: [Select]
    1. 'Find the Gold! by SierraKen
    2. 'October 21, 2020
    3. 'Thanks for the great mapping code by FellipeHeitor and help from B+!
    4. 'This is mostly an example game, I hope to expand on it sometime soon.
    5.  
    6.  
    7. SCREEN _NEWIMAGE(1000, 800, 32)
    8.  
    9. TYPE object
    10.     x AS SINGLE
    11.     y AS SINGLE
    12.  
    13. DIM SHARED player AS object
    14. DIM SHARED camera AS object
    15. DIM playerSpeed AS SINGLE
    16.  
    17. _TITLE "Find The Gold! One gold bar per map. Use your arrow keys."
    18.  
    19. start:
    20. player.x = _WIDTH / 2
    21. player.y = _HEIGHT / 2
    22.  
    23. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
    24.  
    25. _DEST map
    26. PAINT (2, 2), _RGB32(0, 200, 0)
    27.  
    28. FOR blocks = 1 TO 400
    29.     blocks:
    30.     xx = (RND * _WIDTH)
    31.     yy = (RND * _HEIGHT)
    32.     sz = INT(RND * 50) + 10
    33.     c1 = INT(RND * 155) + 100
    34.     c2 = INT(RND * 155) + 100
    35.     c3 = INT(RND * 155) + 100
    36.     LINE (xx, yy)-(xx + sz, yy + sz), _RGB32(c1, c2, c3), BF
    37.     IF POINT(_WIDTH / 2, _HEIGHT / 2) = _RGB32(c1, c2, c3) THEN GOTO blocks:
    38. FOR lakes = 1 TO 10
    39.     w = RND
    40.     h = RND
    41.     sze = (RND * 150) + 50
    42.     FOR sz = .25 TO sze STEP .25
    43.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 0, 255)
    44.     NEXT sz
    45. NEXT lakes
    46. w2 = INT(RND * _WIDTH) - 15
    47. h2 = INT(RND * _HEIGHT) - 10
    48. IF w2 < 15 THEN w2 = 15
    49. IF h2 < 10 THEN h2 = 10
    50.  
    51. 'Gold
    52. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
    53. _PRINTSTRING (w2, h2), "GOLD"
    54.  
    55.  
    56.  
    57. playerSpeed = 10
    58.  
    59. CONST keyUP = 18432
    60. CONST keyDOWN = 20480
    61. CONST keyLEFT = 19200
    62. CONST keyRIGHT = 19712
    63.  
    64.     CLS
    65.  
    66.     _PUTIMAGE (camera.x, camera.y), map
    67.  
    68.     IF _KEYDOWN(keyUP) THEN player.y = player.y - playerSpeed
    69.     IF _KEYDOWN(keyDOWN) THEN player.y = player.y + playerSpeed
    70.     IF _KEYDOWN(keyLEFT) THEN player.x = player.x - playerSpeed
    71.     IF _KEYDOWN(keyRIGHT) THEN player.x = player.x + playerSpeed
    72.  
    73.     IF player.x < 0 THEN player.x = 0
    74.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
    75.     IF player.y < 0 THEN player.y = 0
    76.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
    77.  
    78.     adjustCamera
    79.  
    80.     'Draw Head
    81.     FOR sz = .25 TO 10 STEP .25
    82.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
    83.     NEXT sz
    84.     'Draw Smile
    85.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
    86.     'Draw Eyes
    87.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    88.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    89.     'hat
    90.     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
    91.     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
    92.     FOR check = -15 TO 15
    93.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    94.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    95.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    96.     NEXT check
    97.  
    98.     _DISPLAY
    99.     _LIMIT 60
    100.  
    101. SUB adjustCamera
    102.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
    103.         camera.x = _WIDTH / 2 - player.x
    104.     END IF
    105.     IF camera.x > 0 THEN camera.x = 0
    106.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
    107.  
    108.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
    109.         camera.y = _HEIGHT / 2 - player.y
    110.     END IF
    111.     IF camera.y > 0 THEN camera.y = 0
    112.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
    113.  
    « Last Edit: October 21, 2020, 10:55:52 pm by SierraKen »

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #22 on: October 21, 2020, 11:14:10 pm »
  • Best Answer
  • Cool mod, Ken!

     
    Captura de Tela 2020-10-22 Ć s 00.12.55.png

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #23 on: October 21, 2020, 11:41:26 pm »
  • Best Answer
  • Thanks Felippe, glad you like it. :)). I can add all kinds of stuff to the map now that I have color detection. :))). Can also make enemies where if you see one on your screen, they come after you. lol I hope I can do that anyway. :) I hope to work on it sometime soon.

    FellippeHeitor

    • Guest

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #25 on: October 22, 2020, 01:20:19 pm »
  • Best Answer
  • Felippe that is totally cool! I felt like I was in a tank game chatting with my counterpart. lol

    Offline qbkiller101

    • Newbie
    • Posts: 73
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #26 on: October 22, 2020, 02:03:01 pm »
  • Best Answer
  • I did it!!! Thanks guys!!!

    This is an example game, which is my first mapped out game like this. I hope to expand it sometime soon and make it more fun. For now, you can move your cowboy around and find one gold bar per map. When you move your guy next to or on the bar, it gives you 100 points and starts over with a brand new map. If I expand on this game, I'll make a new forum thread for it. But this is what I have so far. I also doubled the cowboy speed from my last post. Oh also, the gold bar is labeled "GOLD" so you know what it is.

    Code: QB64: [Select]
    1. 'Find the Gold! by SierraKen
    2. 'October 21, 2020
    3. 'Thanks for the great mapping code by FellipeHeitor and help from B+!
    4. 'This is mostly an example game, I hope to expand on it sometime soon.
    5.  
    6.  
    7. SCREEN _NEWIMAGE(1000, 800, 32)
    8.  
    9. TYPE object
    10.     x AS SINGLE
    11.     y AS SINGLE
    12.  
    13. DIM SHARED player AS object
    14. DIM SHARED camera AS object
    15. DIM playerSpeed AS SINGLE
    16.  
    17. _TITLE "Find The Gold! One gold bar per map. Use your arrow keys."
    18.  
    19. start:
    20. player.x = _WIDTH / 2
    21. player.y = _HEIGHT / 2
    22.  
    23. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
    24.  
    25. _DEST map
    26. PAINT (2, 2), _RGB32(0, 200, 0)
    27.  
    28. FOR blocks = 1 TO 400
    29.     blocks:
    30.     xx = (RND * _WIDTH)
    31.     yy = (RND * _HEIGHT)
    32.     sz = INT(RND * 50) + 10
    33.     c1 = INT(RND * 155) + 100
    34.     c2 = INT(RND * 155) + 100
    35.     c3 = INT(RND * 155) + 100
    36.     LINE (xx, yy)-(xx + sz, yy + sz), _RGB32(c1, c2, c3), BF
    37.     IF POINT(_WIDTH / 2, _HEIGHT / 2) = _RGB32(c1, c2, c3) THEN GOTO blocks:
    38. FOR lakes = 1 TO 10
    39.     w = RND
    40.     h = RND
    41.     sze = (RND * 150) + 50
    42.     FOR sz = .25 TO sze STEP .25
    43.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 0, 255)
    44.     NEXT sz
    45. NEXT lakes
    46. w2 = INT(RND * _WIDTH) - 15
    47. h2 = INT(RND * _HEIGHT) - 10
    48. IF w2 < 15 THEN w2 = 15
    49. IF h2 < 10 THEN h2 = 10
    50.  
    51. 'Gold
    52. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
    53. _PRINTSTRING (w2, h2), "GOLD"
    54.  
    55.  
    56.  
    57. playerSpeed = 10
    58.  
    59. CONST keyUP = 18432
    60. CONST keyDOWN = 20480
    61. CONST keyLEFT = 19200
    62. CONST keyRIGHT = 19712
    63.  
    64.     CLS
    65.  
    66.     _PUTIMAGE (camera.x, camera.y), map
    67.  
    68.     IF _KEYDOWN(keyUP) THEN player.y = player.y - playerSpeed
    69.     IF _KEYDOWN(keyDOWN) THEN player.y = player.y + playerSpeed
    70.     IF _KEYDOWN(keyLEFT) THEN player.x = player.x - playerSpeed
    71.     IF _KEYDOWN(keyRIGHT) THEN player.x = player.x + playerSpeed
    72.  
    73.     IF player.x < 0 THEN player.x = 0
    74.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
    75.     IF player.y < 0 THEN player.y = 0
    76.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
    77.  
    78.     adjustCamera
    79.  
    80.     'Draw Head
    81.     FOR sz = .25 TO 10 STEP .25
    82.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
    83.     NEXT sz
    84.     'Draw Smile
    85.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
    86.     'Draw Eyes
    87.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    88.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    89.     'hat
    90.     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
    91.     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
    92.     FOR check = -15 TO 15
    93.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    94.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    95.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    96.     NEXT check
    97.  
    98.     _DISPLAY
    99.     _LIMIT 60
    100.  
    101. SUB adjustCamera
    102.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
    103.         camera.x = _WIDTH / 2 - player.x
    104.     END IF
    105.     IF camera.x > 0 THEN camera.x = 0
    106.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
    107.  
    108.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
    109.         camera.y = _HEIGHT / 2 - player.y
    110.     END IF
    111.     IF camera.y > 0 THEN camera.y = 0
    112.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
    113.  

    I added 4 lines for wasd at 79 to 82
    but, as always, BUGS:
    pressing both keys of movement in specific direction: e.g. w and right arrow, maks faster movement
    ITS A FEATURE
    Code: QB64: [Select]
    1. 'Find the Gold! by SierraKen
    2. 'October 21, 2020
    3. 'Thanks for the great mapping code by FellipeHeitor and help from B+!
    4. 'This is mostly an example game, I hope to expand on it sometime soon.
    5.  
    6.  
    7. SCREEN _NEWIMAGE(800, 600, 32)
    8.  
    9. TYPE object
    10.     x AS SINGLE
    11.     y AS SINGLE
    12.  
    13. DIM SHARED player AS object
    14. DIM SHARED camera AS object
    15. DIM playerSpeed AS SINGLE
    16.  
    17. _TITLE "Find The Gold! One gold bar per map. Use your arrow keys."
    18.  
    19. start:
    20. player.x = _WIDTH / 2
    21. player.y = _HEIGHT / 2
    22.  
    23. map = _NEWIMAGE(_WIDTH * 7, _HEIGHT * 7, 32)
    24.  
    25. _DEST map
    26. PAINT (2, 2), _RGB32(0, 200, 0)
    27.  
    28. FOR blocks = 1 TO 400
    29.     blocks:
    30.     xx = (RND * _WIDTH)
    31.     yy = (RND * _HEIGHT)
    32.     sz = INT(RND * 50) + 10
    33.     c1 = INT(RND * 155) + 100
    34.     c2 = INT(RND * 155) + 100
    35.     c3 = INT(RND * 155) + 100
    36.     LINE (xx, yy)-(xx + sz, yy + sz), _RGB32(c1, c2, c3), BF
    37.     IF POINT(_WIDTH / 2, _HEIGHT / 2) = _RGB32(c1, c2, c3) THEN GOTO blocks:
    38. FOR lakes = 1 TO 10
    39.     w = RND
    40.     h = RND
    41.     sze = (RND * 150) + 50
    42.     FOR sz = .25 TO sze STEP .25
    43.         CIRCLE (w * _WIDTH, h * _HEIGHT), sz, _RGB32(0, 0, 255)
    44.     NEXT sz
    45. NEXT lakes
    46. w2 = INT(RND * _WIDTH) - 15
    47. h2 = INT(RND * _HEIGHT) - 10
    48. IF w2 < 15 THEN w2 = 15
    49. IF h2 < 10 THEN h2 = 10
    50.  
    51. 'Gold
    52. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 128)
    53. _PRINTSTRING (w2, h2), "GOLD"
    54.  
    55.  
    56.  
    57. playerSpeed = 10
    58.  
    59. CONST keyUP = 18432
    60. CONST keyDOWN = 20480
    61. CONST keyLEFT = 19200
    62. CONST keyRIGHT = 19712
    63.  
    64.     CLS
    65.  
    66.     _PUTIMAGE (camera.x, camera.y), map
    67.  
    68.     IF _KEYDOWN(keyUP) THEN player.y = player.y - playerSpeed
    69.     IF _KEYDOWN(keyDOWN) THEN player.y = player.y + playerSpeed
    70.     IF _KEYDOWN(keyLEFT) THEN player.x = player.x - playerSpeed
    71.     IF _KEYDOWN(keyRIGHT) THEN player.x = player.x + playerSpeed
    72.     IF _KEYDOWN(119) THEN player.y = player.y - playerSpeed 'Omer Hijazi
    73.     IF _KEYDOWN(115) THEN player.y = player.y + playerSpeed 'Omer Hijazi
    74.     IF _KEYDOWN(97) THEN player.x = player.x - playerSpeed 'Omer Hijazi
    75.     IF _KEYDOWN(100) THEN player.x = player.x + playerSpeed 'Omer Hijazi
    76.  
    77.  
    78.     IF player.x < 0 THEN player.x = 0
    79.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
    80.     IF player.y < 0 THEN player.y = 0
    81.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
    82.  
    83.     adjustCamera
    84.  
    85.     'Draw Head
    86.     FOR sz = .25 TO 10 STEP .25
    87.         CIRCLE (player.x + camera.x, player.y + camera.y), sz, _RGB32(255, 166, 127)
    88.     NEXT sz
    89.     'Draw Smile
    90.     CIRCLE (player.x + camera.x, player.y + camera.y + 2), 7, _RGB32(255, 0, 0), _PI, 2 * _PI, .5
    91.     'Draw Eyes
    92.     CIRCLE (player.x + camera.x - 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    93.     CIRCLE (player.x + camera.x + 4, player.y + camera.y - 2), 1, _RGB32(0, 0, 255)
    94.     'hat
    95.     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
    96.     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
    97.     FOR check = -15 TO 15
    98.         IF POINT(player.x + check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    99.         IF POINT(player.x + check, player.y - check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    100.         IF POINT(player.x - check, player.y + check) = _RGB32(255, 255, 128) THEN SOUND 500, .5: score = score + 100: score$ = STR$(score): _TITLE "Score: " + score$: GOTO start:
    101.     NEXT check
    102.  
    103.     _DISPLAY
    104.     _LIMIT 60
    105.  
    106. SUB adjustCamera
    107.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
    108.         camera.x = _WIDTH / 2 - player.x
    109.     END IF
    110.     IF camera.x > 0 THEN camera.x = 0
    111.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
    112.  
    113.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
    114.         camera.y = _HEIGHT / 2 - player.y
    115.     END IF
    116.     IF camera.y > 0 THEN camera.y = 0
    117.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
    118.  

    Offline Petr

    • Forum Resident
    • Posts: 1720
    • The best code is the DNA of the hops.
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #27 on: October 22, 2020, 03:00:12 pm »
  • Best Answer
  • Perfect work, Fellippe. I like this.

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #28 on: October 22, 2020, 03:01:08 pm »
  • Best Answer
  • @SierraKen lol, I was away from the keyboard and I just saw your messages in the game chat! Glad you enjoyed it.

    @qbkiller101 that doesn't qualify as a bug - you are indeed reading two keys and changing the player's position, so it all seems to be working exactly as you wrote it ;-)

    @Petr glad you enjoyed it! You just helped me find a bug just by joining the US server, thank you for trying it :-)

    Offline Petr

    • Forum Resident
    • Posts: 1720
    • The best code is the DNA of the hops.
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #29 on: October 22, 2020, 03:07:07 pm »
  • Best Answer
  • Really? Which bug? I donĀ“t see none bug :)