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

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
Pretentious not-yet-a-clone clone of Among Us in QB64
« on: October 18, 2020, 11:43:54 am »
Watch as I talk about Among Us while writing something that vaguely resembles a player moving around a map.



Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2.  
  3. TYPE object
  4.     x AS SINGLE
  5.     y AS SINGLE
  6.  
  7. DIM SHARED player AS object
  8. DIM SHARED camera AS object
  9. DIM playerSpeed AS SINGLE
  10.  
  11. map = _NEWIMAGE(_WIDTH * 3, _HEIGHT * 2, 32)
  12. _DEST map
  13. FOR i = 1 TO 50
  14.     CircleFill _WIDTH * RND, _HEIGHT * RND, 1000 * RND, _RGB32(255 * RND, 255 * RND, 255 * RND, 255 * RND)
  15.  
  16. player.x = _WIDTH / 2
  17. player.y = _HEIGHT / 2
  18.  
  19. playerSpeed = 5
  20.  
  21. CONST keyUP = 18432
  22. CONST keyDOWN = 20480
  23. CONST keyLEFT = 19200
  24. CONST keyRIGHT = 19712
  25.  
  26.     IF _KEYDOWN(keyUP) THEN player.y = player.y - playerSpeed
  27.     IF _KEYDOWN(keyDOWN) THEN player.y = player.y + playerSpeed
  28.     IF _KEYDOWN(keyLEFT) THEN player.x = player.x - playerSpeed
  29.     IF _KEYDOWN(keyRIGHT) THEN player.x = player.x + playerSpeed
  30.  
  31.     IF player.x < 0 THEN player.x = 0
  32.     IF player.x > _WIDTH(map) THEN player.x = _WIDTH(map)
  33.     IF player.y < 0 THEN player.y = 0
  34.     IF player.y > _HEIGHT(map) THEN player.y = _HEIGHT(map)
  35.  
  36.     adjustCamera
  37.     CLS
  38.     _PUTIMAGE (camera.x, camera.y), map
  39.  
  40.     CircleFill player.x + camera.x, player.y + camera.y, 20, _RGB32(255)
  41.     _DISPLAY
  42.     _LIMIT 60
  43.  
  44. SUB adjustCamera
  45.     IF player.x + camera.x > _WIDTH / 2 OR player.x + camera.x < _WIDTH / 2 THEN
  46.         camera.x = _WIDTH / 2 - player.x
  47.     END IF
  48.     IF camera.x > 0 THEN camera.x = 0
  49.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
  50.  
  51.     IF player.y + camera.y > _HEIGHT / 2 OR player.y + camera.y < _HEIGHT / 2 THEN
  52.         camera.y = _HEIGHT / 2 - player.y
  53.     END IF
  54.     IF camera.y > 0 THEN camera.y = 0
  55.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
  56.  
  57. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  58.     ' CX = center x coordinate
  59.     ' CY = center y coordinate
  60.     '  R = radius
  61.     '  C = fill color
  62.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  63.     DIM X AS INTEGER, Y AS INTEGER
  64.     Radius = ABS(R)
  65.     RadiusError = -Radius
  66.     X = Radius
  67.     Y = 0
  68.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  69.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  70.     WHILE X > Y
  71.         RadiusError = RadiusError + Y * 2 + 1
  72.         IF RadiusError >= 0 THEN
  73.             IF X <> Y + 1 THEN
  74.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  75.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  76.             END IF
  77.             X = X - 1
  78.             RadiusError = RadiusError - X * 2
  79.         END IF
  80.         Y = Y + 1
  81.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  82.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  83.     WEND
« Last Edit: October 26, 2020, 01:07:43 am by FellippeHeitor »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Pretentious not-really-a-clone clone of Among Us in QB64
« Reply #1 on: October 18, 2020, 04:03:50 pm »
  • Best Answer
  • Lol.  Thanks for leaving in the blooper.  I needed a laugh.. 

    - Dav

    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 #2 on: October 18, 2020, 04:43:59 pm »
  • Best Answer
  • Wow just add image of a map and player is walking around map, nice!

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #3 on: October 19, 2020, 04:29:25 pm »
  • Best Answer
  • @Dav glad it was entertaining!

    @bplus the illusion is the key, thanks for checking it out!

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #4 on: October 20, 2020, 12:53:07 pm »
  • Best Answer
  • Run this and choose "Connect to server" - arbitrarily limited to 10 simultaneous "players" for now.

    It's the map+player code of the first post, with networking added. Still not a game, but you can see other players in real time, which is cool.

    If you have trouble connecting to 98.29.249.134 (kindly hosted by SpriggsySprigs in the US), replace that on line 97 with alephc.xyz (kindly hosted by Luke in Australia).

    Code: QB64: [Select]
    1.  
    2. $LET DEBUGGING = FALSE
    3. $IF DEBUGGING = TRUE THEN
    4.     $CONSOLE
    5.  
    6. CONST True = -1, False = 0
    7. CONST mode_freeplay = 0
    8. CONST mode_localhost = 1
    9. CONST mode_localclient = 2
    10. CONST mode_onlinehost = 3
    11. CONST mode_onlineclient = 4
    12.  
    13. TYPE object
    14.     name AS STRING
    15.     handle AS LONG
    16.     x AS SINGLE
    17.     y AS SINGLE
    18.     state AS INTEGER
    19.     basicInfoSent AS _BYTE
    20.     ping AS SINGLE
    21.  
    22. DIM SHARED totalClients AS INTEGER
    23. DIM SHARED playerStream(1 TO 10) AS STRING
    24. DIM SHARED serverStream AS STRING
    25. DIM SHARED player(1 TO 10) AS object, me AS INTEGER
    26. DIM SHARED warning(1 TO 30) AS object
    27. DIM idSet AS _BYTE
    28. DIM newClient AS LONG
    29. DIM serverPing AS SINGLE
    30. DIM key$, value$
    31.  
    32. DIM SHARED endSignal AS STRING
    33. endSignal = "<" + CHR$(254) + ">"
    34.  
    35. vgaPalette:
    36. DATA 0,0,170
    37. DATA 0,170,0
    38. DATA 0,170,170
    39. DATA 170,0,0
    40. DATA 170,0,170
    41. DATA 170,85,0
    42. DATA 170,170,170
    43. DATA 85,85,85
    44. DATA 85,85,255
    45. DATA 85,255,85
    46. DATA 85,255,255
    47. DATA 255,85,85
    48. DATA 255,85,255
    49. DATA 255,255,85
    50. DATA 255,255,255
    51.  
    52. RESTORE vgaPalette
    53. FOR i = 1 TO 15
    54.     READ r%, g%, b%
    55.     colors(i) = _RGB32(r%, g%, b%)
    56.  
    57. CONST timeout = 30
    58. DIM userName$, userColor%
    59. INPUT "Name: ", userName$
    60.     INPUT "Color (1-15): ", userColor%
    61. LOOP WHILE userColor% < 1 OR userColor% > 15
    62.  
    63.     COLOR 15
    64.     PRINT "-------------------------"
    65.     PRINT "(1) Free play"
    66.     PRINT "(2) Connect to server"
    67.  
    68.     DIM choice AS STRING
    69.     DO
    70.         choice = INKEY$
    71.         _LIMIT 30
    72.     LOOP UNTIL choice >= "1" AND choice <= "5"
    73.  
    74.     DIM SHARED server AS object, host AS LONG
    75.     DIM c AS INTEGER, attempt AS INTEGER
    76.     CONST maxAttempts = 100
    77.     SELECT CASE VAL(choice)
    78.         CASE 1
    79.             EXIT DO
    80.         CASE 2
    81.             COLOR 7
    82.             PRINT "Attempting to connect to local host... ";
    83.             r = CSRLIN: c = POS(1)
    84.             attempt = 0
    85.             DO
    86.                 server.handle = 0
    87.                 server.handle = _OPENCLIENT("TCP/IP:51512:98.29.249.134")
    88.                 IF server.handle THEN EXIT DO
    89.                 attempt = attempt + 1
    90.                 LOCATE r, c: PRINT USING "###%"; (attempt / maxAttempts) * 100;
    91.                 _LIMIT 30
    92.             LOOP WHILE attempt < 100
    93.             IF server.handle THEN serverPing = TIMER: mode = mode_localclient: EXIT DO
    94.             PRINT: COLOR 14: PRINT "/\ ";: COLOR 12
    95.             PRINT "Failed to connect to local host."
    96.             CLOSE server.handle
    97.     END SELECT
    98.  
    99. SCREEN _NEWIMAGE(800, 600, 32)
    100.  
    101. DIM SHARED playerSpeed AS SINGLE
    102. DIM SHARED camera AS object
    103.  
    104. map = _NEWIMAGE(_WIDTH * 3, _HEIGHT * 2, 32)
    105. _DEST map
    106. FOR i = 1 TO 50
    107.     CircleFill RND * _WIDTH, RND * _HEIGHT, RND * 1000, _RGB32(RND * 255, RND * 255, RND * 255, RND * 150)
    108.  
    109. CONST keyUP = 18432
    110. CONST keyDOWN = 20480
    111. CONST keyLEFT = 19200
    112. CONST keyRIGHT = 19712
    113. CONST keyLSHIFT = 100304
    114. CONST keyRSHIFT = 100303
    115.  
    116. CONST cameraWindow = 100
    117.  
    118. CONST minSpeed = 3
    119. CONST maxSpeed = 5
    120.  
    121. playerSpeed = maxSpeed
    122.  
    123. IF mode > 1 THEN
    124.     idSet = False
    125.     idSet = True
    126.     me = 1
    127.     player(me).name = userName$
    128.     player(me).x = _WIDTH / 2 + COS(RND * _PI) * (RND * 100)
    129.     player(me).y = _HEIGHT / 2 + SIN(RND * _PI) * (RND * 100)
    130.     player(me).state = True
    131.     player(me).color = userColor%
    132.     SELECT CASE mode
    133.         CASE mode_localhost
    134.             'check for new connections (unless already at max)
    135.             IF idSet = False THEN
    136.                 idSet = True
    137.                 me = 1
    138.                 player(me).name = userName$
    139.                 player(me).x = _WIDTH / 2 + COS(RND * _PI) * (RND * 100)
    140.                 player(me).y = _HEIGHT / 2 + SIN(RND * _PI) * (RND * 100)
    141.                 player(me).state = True
    142.                 player(me).color = userColor%
    143.             END IF
    144.  
    145.             IF totalClients < UBOUND(player) THEN
    146.                 newClient = 0
    147.                 newClient = _OPENCONNECTION(host)
    148.                 IF newClient THEN
    149.                     totalClients = totalClients + 1
    150.                     FOR i = 1 TO UBOUND(player)
    151.                         IF player(i).state = False THEN
    152.                             player(i).color = 0
    153.                             player(i).handle = newClient
    154.                             player(i).state = True
    155.                             sendData player(i), "ID", MKI$(i)
    156.                             player(i).ping = TIMER
    157.                             EXIT FOR
    158.                         END IF
    159.                     NEXT
    160.                 END IF
    161.             END IF
    162.  
    163.             FOR i = 1 TO UBOUND(player)
    164.                 IF player(i).state = False OR i = me THEN _CONTINUE
    165.                 IF TIMER - player(i).ping > timeout THEN
    166.                     'player inactive
    167.                     player(i).state = False
    168.                     CLOSE player(i).handle
    169.                     addWarning player(i).name + " lost connection."
    170.                     totalClients = totalClients - 1
    171.                     _CONTINUE
    172.                 END IF
    173.  
    174.                 getData player(i), playerStream(i)
    175.  
    176.                 DO WHILE parse(playerStream(i), key$, value$)
    177.                     player(i).ping = TIMER
    178.                     SELECT CASE key$
    179.                         CASE "NAME"
    180.                             player(i).name = value$
    181.                         CASE "COLOR" 'received once per player
    182.                             DIM newcolor AS INTEGER, changed AS _BYTE
    183.                             newcolor = CVI(value$)
    184.                             changed = False
    185.                             'check if this color is already in use, so a random one can be assigned
    186.                             FOR j = 1 TO UBOUND(player)
    187.                                 IF player(j).state = True AND player(j).color = newcolor THEN
    188.                                     newcolor = newcolor + 1
    189.                                     IF newcolor > UBOUND(colors) THEN newcolor = 1
    190.                                     changed = True
    191.                                     j = 0 'check again
    192.                                 END IF
    193.                             NEXT
    194.                             player(i).color = newcolor
    195.                             IF changed THEN
    196.                                 sendData player(i), "COLOR", MKI$(newcolor)
    197.                             END IF
    198.                         CASE "POS"
    199.                             player(i).x = CVI(LEFT$(value$, 2))
    200.                             player(i).y = CVI(RIGHT$(value$, 2))
    201.                     END SELECT
    202.                 LOOP
    203.  
    204.                 'send ping
    205.                 sendData player(i), "PING", ""
    206.  
    207.                 'send all players' data
    208.                 FOR j = 1 TO UBOUND(player)
    209.                     IF j = i THEN _CONTINUE
    210.                     IF player(j).state = True THEN
    211.                         sendData player(i), "PLAYERCOLOR", MKI$(j) + MKI$(player(j).color)
    212.                         sendData player(i), "PLAYERPOS", MKI$(j) + MKS$(player(j).x) + MKS$(player(j).y)
    213.                         sendData player(i), "PLAYERNAME", MKI$(j) + player(j).name
    214.                     ELSE
    215.                         sendData player(i), "PLAYEROFFLINE", MKI$(j)
    216.                     END IF
    217.                 NEXT
    218.             NEXT
    219.  
    220.         CASE mode_localclient, mode_onlineclient
    221.             IF idSet THEN
    222.                 IF player(me).basicInfoSent = False THEN
    223.                     player(me).basicInfoSent = True
    224.                     sendData server, "COLOR", MKI$(player(me).color)
    225.                     sendData server, "NAME", player(me).name
    226.                 END IF
    227.  
    228.                 sendData server, "POS", MKI$(player(me).x) + MKI$(player(me).y)
    229.             END IF
    230.  
    231.             getData server, serverStream
    232.             DO WHILE parse(serverStream, key$, value$)
    233.                 SELECT CASE key$
    234.                     CASE "ID" 'first info sent by server
    235.                         idSet = True
    236.                         me = CVI(value$)
    237.                         player(me).name = userName$
    238.                         player(me).x = _WIDTH / 2 + COS(RND * _PI) * (RND * 100)
    239.                         player(me).y = _HEIGHT / 2 + SIN(RND * _PI) * (RND * 100)
    240.                         player(me).state = True
    241.                         player(me).color = userColor%
    242.                     CASE "COLOR" 'server color changes must always be applied
    243.                         player(me).color = CVI(value$)
    244.                     CASE "PLAYERCOLOR"
    245.                         player(CVI(LEFT$(value$, 2))).color = CVI(RIGHT$(value$, 2))
    246.                     CASE "PLAYERPOS"
    247.                         player(CVI(LEFT$(value$, 2))).state = True
    248.                         player(CVI(LEFT$(value$, 2))).ping = TIMER
    249.                         player(CVI(LEFT$(value$, 2))).x = CVS(MID$(value$, 3, 4))
    250.                         player(CVI(LEFT$(value$, 2))).y = CVS(RIGHT$(value$, 4))
    251.                     CASE "PLAYERNAME"
    252.                         player(CVI(LEFT$(value$, 2))).name = MID$(value$, 3)
    253.                     CASE "PLAYEROFFLINE"
    254.                         IF player(CVI(value$)).state = True THEN
    255.                             player(CVI(value$)).state = False
    256.                             addWarning player(CVI(value$)).name + " left the game."
    257.                         END IF
    258.                     CASE "PING"
    259.                         serverPing = TIMER
    260.                 END SELECT
    261.             LOOP
    262.     END SELECT
    263.  
    264.     IF playerSpeed < minSpeed THEN playerSpeed = minSpeed
    265.     IF playerSpeed > maxSpeed THEN playerSpeed = maxSpeed
    266.  
    267.     IF idSet THEN
    268.         IF _KEYDOWN(keyUP) THEN player(me).y = player(me).y - playerSpeed
    269.         IF _KEYDOWN(keyDOWN) THEN player(me).y = player(me).y + playerSpeed
    270.         IF _KEYDOWN(keyLEFT) THEN player(me).x = player(me).x - playerSpeed
    271.         IF _KEYDOWN(keyRIGHT) THEN player(me).x = player(me).x + playerSpeed
    272.  
    273.         IF player(me).x < 0 THEN player(me).x = 0
    274.         IF player(me).y < 0 THEN player(me).y = 0
    275.         IF player(me).x > _WIDTH(map) THEN player(me).x = _WIDTH(map)
    276.         IF player(me).y > _HEIGHT(map) THEN player(me).y = _HEIGHT(map)
    277.  
    278.         adjustCamera
    279.     END IF
    280.  
    281.     CLS
    282.  
    283.     DIM shipFlotation AS SINGLE, shipFloatIntensity AS SINGLE
    284.     shipFlotation = shipFlotation + .05
    285.     IF shipFlotation > _PI(2) THEN shipFlotation = shipFlotation - _PI(2)
    286.     shipFloatIntensity = 1.5
    287.  
    288.     _PUTIMAGE (camera.x + COS(shipFlotation) * shipFloatIntensity, camera.y + SIN(shipFlotation) * shipFloatIntensity), map
    289.     _BLEND
    290.  
    291.     IF (mode = mode_localclient OR mode = mode_onlineclient) THEN
    292.         IF TIMER - serverPing > timeout THEN
    293.             SCREEN 0
    294.             PRINT: COLOR 14: PRINT "/\ ";: COLOR 12
    295.             PRINT "Disconnected from host."
    296.             END
    297.         ELSE
    298.             PRINT USING "###ms"; ((TIMER - serverPing) - FIX(TIMER - serverPing)) * 1000;
    299.         END IF
    300.     END IF
    301.  
    302.     DIM x AS SINGLE, y AS SINGLE
    303.     FOR i = 1 TO UBOUND(player)
    304.         IF player(i).state = False OR player(i).color = 0 THEN _CONTINUE
    305.         x = player(i).x + camera.x + COS(shipFlotation) * shipFloatIntensity
    306.         y = player(i).y + camera.y + SIN(shipFlotation) * shipFloatIntensity
    307.         CircleFill x, y + 6, 15, _RGB32(0, 50)
    308.         CircleFill x, y, 15, _RGB32(0)
    309.         CircleFill x, y, 10, colors(player(i).color)
    310.         COLOR _RGB32(0)
    311.         _PRINTSTRING (1 + x - _PRINTWIDTH(player(i).name) / 2, 1 + y - 20), player(i).name
    312.         COLOR _RGB32(255)
    313.         _PRINTSTRING (x - _PRINTWIDTH(player(i).name) / 2, y - 20), player(i).name
    314.     NEXT
    315.     'LINE (_WIDTH / 2 - cameraWindow, _HEIGHT / 2 - cameraWindow)-STEP(cameraWindow * 2, cameraWindow * 2), , B
    316.  
    317.     'display warnings
    318.     FOR i = 1 TO UBOUND(warning)
    319.         COLOR _RGB32(128, 50, 22)
    320.         IF warning(i).state = True THEN
    321.             _PRINTSTRING (10, _HEIGHT / 2 + _FONTHEIGHT * i), warning(i).name
    322.             IF TIMER - warning(i).ping > 2 THEN warning(i).state = False
    323.         END IF
    324.     NEXT
    325.  
    326.     _DISPLAY
    327.     _LIMIT 60
    328.  
    329. SUB addWarning (text$)
    330.     DIM i AS INTEGER
    331.     FOR i = 1 TO UBOUND(warning)
    332.         IF warning(i).state = False THEN
    333.             warning(i).state = True
    334.             warning(i).name = text$
    335.             warning(i).ping = TIMER
    336.             EXIT FOR
    337.         END IF
    338.     NEXT
    339.  
    340. SUB sendData (client AS object, id$, value$)
    341.     DIM key$
    342.     key$ = id$ + ">" + value$ + endSignal
    343.     PUT #client.handle, , key$
    344.  
    345. SUB getData (client AS object, buffer AS STRING)
    346.     DIM incoming$
    347.     GET #client.handle, , incoming$
    348.     buffer = buffer + incoming$
    349.  
    350. FUNCTION parse%% (buffer AS STRING, key$, value$)
    351.     DIM endMarker AS LONG
    352.     endMarker = INSTR(buffer, endSignal)
    353.     IF endMarker THEN
    354.         key$ = LEFT$(buffer, endMarker - 1)
    355.         buffer = MID$(buffer, endMarker + LEN(endSignal))
    356.         endMarker = INSTR(key$, ">")
    357.         value$ = MID$(key$, endMarker + 1)
    358.         key$ = LEFT$(key$, endMarker - 1)
    359.         parse%% = True
    360.     END IF
    361.  
    362. SUB adjustCamera
    363.     IF player(me).x + camera.x > _WIDTH / 2 + cameraWindow THEN
    364.         camera.x = _WIDTH / 2 - player(me).x + cameraWindow
    365.     ELSEIF player(me).x + camera.x < _WIDTH / 2 - cameraWindow THEN
    366.         camera.x = _WIDTH / 2 - player(me).x - cameraWindow
    367.     END IF
    368.     IF camera.x > 0 THEN camera.x = 0
    369.     IF camera.x < -(_WIDTH(map) - _WIDTH) THEN camera.x = -(_WIDTH(map) - _WIDTH)
    370.  
    371.     IF player(me).y + camera.y > _HEIGHT / 2 + cameraWindow THEN
    372.         camera.y = _HEIGHT / 2 - player(me).y + cameraWindow
    373.     ELSEIF player(me).y + camera.y < _HEIGHT / 2 - cameraWindow THEN
    374.         camera.y = _HEIGHT / 2 - player(me).y - cameraWindow
    375.     END IF
    376.     IF camera.y > 0 THEN camera.y = 0
    377.     IF camera.y < -(_HEIGHT(map) - _HEIGHT) THEN camera.y = -(_HEIGHT(map) - _HEIGHT)
    378.  
    379.  
    380. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    381.     ' CX = center x coordinate
    382.     ' CY = center y coordinate
    383.     '  R = radius
    384.     '  C = fill color
    385.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    386.     DIM X AS INTEGER, Y AS INTEGER
    387.     Radius = ABS(R)
    388.     RadiusError = -Radius
    389.     X = Radius
    390.     Y = 0
    391.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    392.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    393.     WHILE X > Y
    394.         RadiusError = RadiusError + Y * 2 + 1
    395.         IF RadiusError >= 0 THEN
    396.             IF X <> Y + 1 THEN
    397.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    398.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    399.             END IF
    400.             X = X - 1
    401.             RadiusError = RadiusError - X * 2
    402.         END IF
    403.         Y = Y + 1
    404.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    405.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    406.     WEND
    407.  
    408. SUB db (text$)
    409.     $IF DEBUGGING = TRUE THEN
    410.         _ECHO text$
    411.     $ELSE
    412.         DIM dummy$
    413.         dummy$ = text$
    414.     $END IF
    « Last Edit: October 20, 2020, 12:55:16 pm by FellippeHeitor »

    Offline Rubidium

    • Newbie
    • Posts: 10
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #5 on: October 20, 2020, 05:16:44 pm »
  • Best Answer
  • Impressive! do you have the code for the server as well? I'd like to try playing around with it :D

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #6 on: October 20, 2020, 05:29:17 pm »
  • Best Answer
  • It's all included above, actually!

    Offline Rubidium

    • Newbie
    • Posts: 10
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #7 on: October 20, 2020, 06:09:22 pm »
  • Best Answer
  • Really cool. With some messenger features and a few collision objects, a lot of kids could get so into this! -for getting into qb64- :D

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #8 on: October 21, 2020, 01:08:11 pm »
  • Best Answer
  • True! I'm hoping to turn it into a real game soon.

    If anyone decides to try the room and eventually finds no one currently logged in, just open two instances of the code above to see two instances of yourself running around.

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #9 on: October 21, 2020, 04:04:11 pm »
  • Best Answer
  • This is great Felippe! I've been wondering how to do this for awhile. I'll try to learn it. I might also drop the CHR$(0) and inkey$ I use for the arrow keys, yours probably works better. Someone could make a really great dungeon type game this way. Thanks!
    « Last Edit: October 21, 2020, 04:06:18 pm by SierraKen »

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #10 on: October 21, 2020, 04:08:07 pm »
  • Best Answer
  • Thanks, Ken! Glad you enjoyed it.

    Did you have luck joining either server? They've both been up since yesterday.

    The advantage of using _KEYDOWN for character movement is that all directions can coexist simultaneously and there's no buffer. Once released, the keys immediately stop coming.

    Offline SierraKen

    • Forum Resident
    • Posts: 1454
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #11 on: October 21, 2020, 05:33:55 pm »
  • Best Answer
  • LOL I see you! I wonder if we can add chat to it? Like text over your nickname.

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #12 on: October 21, 2020, 05:34:35 pm »
  • Best Answer
  • I'll be implementing chat soon, but for now there's no length limit for player name - it's a rudimentary messaging system as is!

    Offline Dav

    • Forum Resident
    • Posts: 792
      • View Profile
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #13 on: October 21, 2020, 05:55:40 pm »
  • Best Answer
  • Works for me.  Connected as is.  Code is so easy to understand. What a great learning example. 

    - Dav 

    FellippeHeitor

    • Guest
    Re: Pretentious not-really-a-clone clone of Among Us in QB64
    « Reply #14 on: October 21, 2020, 05:57:39 pm »
  • Best Answer
  • Damn, I missed you! Australia or US?