Author Topic: "Among Us" Ejection Screen  (Read 2415 times)

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
"Among Us" Ejection Screen
« on: September 27, 2020, 06:00:01 pm »
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2.  
  3. TYPE object
  4.     x AS SINGLE
  5.     y AS SINGLE
  6.     size AS SINGLE
  7.     speed AS SINGLE
  8.  
  9. DIM SHARED star(1 TO 100) AS object
  10. FOR i = 1 TO 100
  11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
  12.     star(i).y = RND * _HEIGHT
  13.     star(i).size = RND * 2
  14.  
  15.  
  16. start = TIMER
  17. message$ = "Player was not The Impostor."
  18.  
  19. _TITLE "Ejection screen"
  20.  
  21.     CLS
  22.  
  23.     FOR i = 1 TO 100
  24.         IF star(i).x > _WIDTH THEN
  25.             star(i).x = -1
  26.             star(i).y = RND * _HEIGHT
  27.         END IF
  28.         star(i).x = star(i).x + star(i).size
  29.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
  30.     NEXT
  31.  
  32.     fadeIn = 3
  33.     IF TIMER - start > fadeIn AND TIMER - lastChar > .05 THEN
  34.         lastChar = TIMER
  35.         IF chars <= LEN(message$) THEN
  36.             chars = chars + 1
  37.             FOR j = 0 TO 2000
  38.                 _SNDRAW SIN(j) / 100
  39.             NEXT
  40.             FOR j = 0 TO 350
  41.                 _SNDRAW 0
  42.             NEXT
  43.         END IF
  44.     ELSE
  45.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
  46.     END IF
  47.     m$ = LEFT$(message$, chars)
  48.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
  49.  
  50.     _DISPLAY
  51.     _LIMIT 30
  52.  
  53. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  54.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  55.  
  56. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  57.     ' CX = center x coordinate
  58.     ' CY = center y coordinate
  59.     '  R = radius
  60.     '  C = fill color
  61.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  62.     DIM X AS INTEGER, Y AS INTEGER
  63.     Radius = ABS(R)
  64.     RadiusError = -Radius
  65.     X = Radius
  66.     Y = 0
  67.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  68.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  69.     WHILE X > Y
  70.         RadiusError = RadiusError + Y * 2 + 1
  71.         IF RadiusError >= 0 THEN
  72.             IF X <> Y + 1 THEN
  73.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  74.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  75.             END IF
  76.             X = X - 1
  77.             RadiusError = RadiusError - X * 2
  78.         END IF
  79.         Y = Y + 1
  80.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  81.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  82.     WEND
  83.  

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: "Among Us" Ejection Screen
« Reply #1 on: September 27, 2020, 06:04:24 pm »
DUDE! That's awesome! I love that game!
Shuwatch!

Marked as best answer by on April 13, 2024, 06:23:29 am

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: "Among Us" Ejection Screen
« Reply #2 on: September 27, 2020, 06:29:47 pm »
  • Undo Best Answer
  • Hehehe I had to do it... I used my recording program and grabbed a snippet of audio from the game when you eject someone so you can use it for the text being written to the screen.

    Code: QB64: [Select]
    1. SCREEN _NEWIMAGE(800, 600, 32)
    2.  
    3. TYPE object
    4.     x AS SINGLE
    5.     y AS SINGLE
    6.     size AS SINGLE
    7.     speed AS SINGLE
    8.  
    9. DIM SHARED star(1 TO 100) AS object
    10. FOR i = 1 TO 100
    11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
    12.     star(i).y = RND * _HEIGHT
    13.     star(i).size = RND * 2
    14.  
    15.  
    16. start = TIMER
    17. message$ = "Player was not The Impostor."
    18.  
    19. _TITLE "Ejection screen"
    20. DIM eject AS LONG
    21. eject = _SNDOPEN("eject.wav")
    22.  
    23.     CLS
    24.  
    25.     FOR i = 1 TO 100
    26.         IF star(i).x > _WIDTH THEN
    27.             star(i).x = -1
    28.             star(i).y = RND * _HEIGHT
    29.         END IF
    30.         star(i).x = star(i).x + star(i).size
    31.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
    32.     NEXT
    33.     fadeIn = 3
    34.     IF TIMER - start > fadeIn AND TIMER - lastChar > .05 THEN
    35.         IF x = 0 THEN
    36.             _SNDPLAY (eject)
    37.             x = 1
    38.         END IF
    39.         lastChar = TIMER
    40.         IF chars <= LEN(message$) THEN
    41.             chars = chars + 1
    42.         END IF
    43.     ELSE
    44.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    45.     END IF
    46.     m$ = LEFT$(message$, chars)
    47.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
    48.  
    49.     _DISPLAY
    50.     _LIMIT 30
    51. _SNDCLOSE eject
    52.  
    53. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    54.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
    55.  
    56. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    57.     ' CX = center x coordinate
    58.     ' CY = center y coordinate
    59.     '  R = radius
    60.     '  C = fill color
    61.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    62.     DIM X AS INTEGER, Y AS INTEGER
    63.     Radius = ABS(R)
    64.     RadiusError = -Radius
    65.     X = Radius
    66.     Y = 0
    67.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    68.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    69.     WHILE X > Y
    70.         RadiusError = RadiusError + Y * 2 + 1
    71.         IF RadiusError >= 0 THEN
    72.             IF X <> Y + 1 THEN
    73.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    74.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    75.             END IF
    76.             X = X - 1
    77.             RadiusError = RadiusError - X * 2
    78.         END IF
    79.         Y = Y + 1
    80.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    81.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    82.     WEND
    * eject.wav (Filesize: 278.41 KB, Downloads: 133)
    Shuwatch!

    Offline Pete

    • Forum Resident
    • Posts: 2361
    • Cuz I sez so, varmint!
    Re: "Among Us" Ejection Screen
    « Reply #3 on: September 27, 2020, 06:48:30 pm »
    Thumbs down. I like star ships that don't drive sideways!

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

    Offline SpriggsySpriggs

    • Forum Resident
    • Posts: 1145
    • Larger than life
      • GitHub
    Re: "Among Us" Ejection Screen
    « Reply #4 on: September 27, 2020, 07:03:53 pm »
    And another little edit haha:
     
    Screenshot 2020-09-27 190352.png

    This time it shoots a green crewmate across the screen first :) I'd make him rotate if I knew how.
    Code: QB64: [Select]
    1. SCREEN _NEWIMAGE(800, 600, 32)
    2.  
    3. TYPE object
    4.     x AS SINGLE
    5.     y AS SINGLE
    6.     size AS SINGLE
    7.     speed AS SINGLE
    8.  
    9. DIM SHARED star(1 TO 100) AS object
    10. FOR i = 1 TO 100
    11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
    12.     star(i).y = RND * _HEIGHT
    13.     star(i).size = RND * 2
    14.  
    15.  
    16. start = TIMER
    17. message$ = "Player was not The Impostor."
    18.  
    19. _TITLE "Ejection screen"
    20. DIM eject AS LONG
    21. DIM crewmate AS LONG
    22. crewmate = _LOADIMAGE("crewmate (Custom).png", 32)
    23. eject = _SNDOPEN("eject.wav")
    24.  
    25.     coord1 = coord1 + 4
    26.     CLS
    27.  
    28.     FOR i = 1 TO 100
    29.         IF star(i).x > _WIDTH THEN
    30.             star(i).x = -1
    31.             star(i).y = RND * _HEIGHT
    32.         END IF
    33.         star(i).x = star(i).x + star(i).size
    34.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
    35.     NEXT
    36.     fadeIn = 3
    37.     IF TIMER - start > fadeIn AND TIMER - lastChar > .05 THEN
    38.         IF x = 0 THEN
    39.             _SNDPLAY (eject)
    40.             x = 1
    41.         END IF
    42.         lastChar = TIMER
    43.         IF chars <= LEN(message$) THEN
    44.             chars = chars + 1
    45.         END IF
    46.     ELSE
    47.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    48.     END IF
    49.     m$ = LEFT$(message$, chars)
    50.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
    51.     _PUTIMAGE (coord1, 250), crewmate, 0
    52.     _DISPLAY
    53.     _LIMIT 30
    54. _SNDCLOSE eject
    55.  
    56. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    57.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
    58.  
    59. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    60.     ' CX = center x coordinate
    61.     ' CY = center y coordinate
    62.     '  R = radius
    63.     '  C = fill color
    64.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    65.     DIM X AS INTEGER, Y AS INTEGER
    66.     Radius = ABS(R)
    67.     RadiusError = -Radius
    68.     X = Radius
    69.     Y = 0
    70.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    71.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    72.     WHILE X > Y
    73.         RadiusError = RadiusError + Y * 2 + 1
    74.         IF RadiusError >= 0 THEN
    75.             IF X <> Y + 1 THEN
    76.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    77.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    78.             END IF
    79.             X = X - 1
    80.             RadiusError = RadiusError - X * 2
    81.         END IF
    82.         Y = Y + 1
    83.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    84.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    85.     WEND

    * crewmate (Custom).png (Filesize: 6.05 KB, Dimensions: 73x80, Views: 337)
    * eject.wav (Filesize: 278.41 KB, Downloads: 123)
    « Last Edit: September 27, 2020, 07:09:28 pm by SpriggsySpriggs »
    Shuwatch!

    Offline Pete

    • Forum Resident
    • Posts: 2361
    • Cuz I sez so, varmint!
    Re: "Among Us" Ejection Screen
    « Reply #5 on: September 27, 2020, 07:13:07 pm »
    I'd eject that crewman, too. It looks like he ate all the replicator donuts!

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

    Offline SpriggsySpriggs

    • Forum Resident
    • Posts: 1145
    • Larger than life
      • GitHub
    Re: "Among Us" Ejection Screen
    « Reply #6 on: September 27, 2020, 07:34:39 pm »
    And another edit: This time, with a defeat screen and the sound of defeat:

    Code: QB64: [Select]
    1. SCREEN _NEWIMAGE(800, 600, 32)
    2.  
    3. TYPE object
    4.     x AS SINGLE
    5.     y AS SINGLE
    6.     size AS SINGLE
    7.     speed AS SINGLE
    8.  
    9. DIM SHARED star(1 TO 100) AS object
    10. FOR i = 1 TO 100
    11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
    12.     star(i).y = RND * _HEIGHT
    13.     star(i).size = RND * 2
    14.  
    15.  
    16. start = TIMER
    17. message$ = "Player was not The Impostor."
    18.  
    19. _TITLE "Ejection screen"
    20. DIM eject AS LONG
    21. DIM crewmate AS LONG
    22. crewmate = _LOADIMAGE("crewmate (Custom).png", 32)
    23. eject = _SNDOPEN("eject.wav")
    24.  
    25.     coord1 = coord1 + 4
    26.     CLS
    27.  
    28.     FOR i = 1 TO 100
    29.         IF star(i).x > _WIDTH THEN
    30.             star(i).x = -1
    31.             star(i).y = RND * _HEIGHT
    32.         END IF
    33.         star(i).x = star(i).x + star(i).size
    34.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
    35.     NEXT
    36.     fadeIn = 3
    37.     IF TIMER - start > fadeIn AND TIMER - lastChar > .05 THEN
    38.         IF x = 0 THEN
    39.             _SNDPLAY (eject)
    40.             x = 1
    41.         END IF
    42.         lastChar = TIMER
    43.         IF chars <= LEN(message$) THEN
    44.             chars = chars + 1
    45.         END IF
    46.     ELSE
    47.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    48.     END IF
    49.     m$ = LEFT$(message$, chars)
    50.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
    51.     IF coord1 < _WIDTH THEN
    52.         _PUTIMAGE (coord1, 250), crewmate, 0
    53.     ELSE
    54.         EXIT DO
    55.     END IF
    56.     _DISPLAY
    57.     _LIMIT 30
    58.  
    59. _FREEIMAGE crewmate
    60. _SNDSTOP (eject)
    61. _SNDCLOSE (eject)
    62.  
    63. SCREEN _LOADIMAGE("among-us-defeat.jpg", 32)
    64. d = _SNDOPEN("defeat.mp3")
    65.  
    66.  
    67.  
    68.  
    69.  
    70. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    71.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
    72.  
    73. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    74.     ' CX = center x coordinate
    75.     ' CY = center y coordinate
    76.     '  R = radius
    77.     '  C = fill color
    78.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    79.     DIM X AS INTEGER, Y AS INTEGER
    80.     Radius = ABS(R)
    81.     RadiusError = -Radius
    82.     X = Radius
    83.     Y = 0
    84.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    85.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    86.     WHILE X > Y
    87.         RadiusError = RadiusError + Y * 2 + 1
    88.         IF RadiusError >= 0 THEN
    89.             IF X <> Y + 1 THEN
    90.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    91.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    92.             END IF
    93.             X = X - 1
    94.             RadiusError = RadiusError - X * 2
    95.         END IF
    96.         Y = Y + 1
    97.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    98.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    99.     WEND

    * defeat.mp3 (Filesize: 310.33 KB, Downloads: 125)
    among-us-defeat.jpg
    * among-us-defeat.jpg (Filesize: 39.57 KB, Dimensions: 1334x750, Views: 230)

    * crewmate (Custom).png (Filesize: 6.05 KB, Dimensions: 73x80, Views: 366)
    * eject.wav (Filesize: 278.41 KB, Downloads: 105)
    Shuwatch!

    FellippeHeitor

    • Guest
    Re: "Among Us" Ejection Screen
    « Reply #7 on: September 27, 2020, 10:36:31 pm »
    Now with rotation:

    Code: QB64: [Select]
    1. SCREEN _NEWIMAGE(800, 600, 32)
    2.  
    3. TYPE object
    4.     x AS SINGLE
    5.     y AS SINGLE
    6.     size AS SINGLE
    7.     speed AS SINGLE
    8.  
    9. DIM SHARED star(1 TO 100) AS object
    10. FOR i = 1 TO 100
    11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
    12.     star(i).y = RND * _HEIGHT
    13.     star(i).size = RND * 2
    14.  
    15.  
    16. start = TIMER
    17. message$ = "Player was not The Impostor."
    18.  
    19. _TITLE "Ejection screen"
    20. DIM eject AS LONG
    21. DIM crewmate AS LONG
    22. crewmate = _LOADIMAGE("crewmate (Custom).png", 32)
    23. eject = _SNDOPEN("eject.wav")
    24.  
    25.     coord1 = coord1 + map(coord1, 0, _WIDTH, 15, 4)
    26.     CLS
    27.  
    28.     FOR i = 1 TO 100
    29.         IF star(i).x > _WIDTH THEN
    30.             star(i).x = -1
    31.             star(i).y = RND * _HEIGHT
    32.         END IF
    33.         star(i).x = star(i).x + star(i).size
    34.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
    35.     NEXT
    36.     fadeIn = 3
    37.     IF TIMER - start > fadeIn AND TIMER - lastChar > .05 THEN
    38.         IF x = 0 THEN
    39.             _SNDPLAY (eject)
    40.             x = 1
    41.         END IF
    42.         lastChar = TIMER
    43.         IF chars <= LEN(message$) THEN
    44.             chars = chars + 1
    45.         END IF
    46.     ELSE
    47.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    48.     END IF
    49.     m$ = LEFT$(message$, chars)
    50.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
    51.     IF coord1 < _WIDTH THEN
    52.         crewMateAngle = crewMateAngle + 2
    53.         RotoZoom3 coord1, 250, crewmate, 1, 1, _D2R(crewMateAngle)
    54.     END IF
    55.     _DISPLAY
    56.     _LIMIT 30
    57. LOOP UNTIL TIMER - start > 8
    58.  
    59. _FREEIMAGE crewmate
    60. _SNDSTOP (eject)
    61. _SNDCLOSE (eject)
    62.  
    63. SCREEN _LOADIMAGE("among-us-defeat.jpg", 32)
    64. d = _SNDOPEN("defeat.mp3")
    65.  
    66.  
    67.  
    68.  
    69.  
    70. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    71.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
    72.  
    73. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    74.     ' CX = center x coordinate
    75.     ' CY = center y coordinate
    76.     '  R = radius
    77.     '  C = fill color
    78.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    79.     DIM X AS INTEGER, Y AS INTEGER
    80.     Radius = ABS(R)
    81.     RadiusError = -Radius
    82.     X = Radius
    83.     Y = 0
    84.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    85.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    86.     WHILE X > Y
    87.         RadiusError = RadiusError + Y * 2 + 1
    88.         IF RadiusError >= 0 THEN
    89.             IF X <> Y + 1 THEN
    90.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    91.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    92.             END IF
    93.             X = X - 1
    94.             RadiusError = RadiusError - X * 2
    95.         END IF
    96.         Y = Y + 1
    97.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    98.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    99.     WEND
    100.  
    101. SUB RotoZoom3 (X AS LONG, Y AS LONG, Image AS LONG, xScale AS SINGLE, yScale AS SINGLE, radianRotation AS SINGLE)
    102.     ' This assumes you have set your drawing location with _DEST or default to screen.
    103.     ' X, Y - is where you want to put the middle of the image
    104.     ' Image - is the handle assigned with _LOADIMAGE
    105.     ' xScale, yScale - are shrinkage < 1 or magnification > 1 on the given axis, 1 just uses image size.
    106.     ' These are multipliers so .5 will create image .5 size on given axis and 2 for twice image size.
    107.     ' radianRotation is the Angle in Radian units to rotate the image
    108.     ' note: Radian units for rotation because it matches angle units of other Basic Trig functions
    109.     '       and saves a little time converting from degree.
    110.     '       Use the _D2R() function if you prefer to work in degree units for angles.
    111.  
    112.     DIM px(3) AS SINGLE: DIM py(3) AS SINGLE ' simple arrays for x, y to hold the 4 corners of image
    113.     DIM W&, H&, sinr!, cosr!, i&, x2&, y2& '   variables for image manipulation
    114.     W& = _WIDTH(Image&): H& = _HEIGHT(Image&)
    115.     px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
    116.     px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
    117.     px(2) = W& / 2: py(2) = H& / 2 '  right bottom
    118.     px(3) = W& / 2: py(3) = -H& / 2 ' right top
    119.     sinr! = SIN(-radianRotation): cosr! = COS(-radianRotation) ' rotation helpers
    120.     FOR i& = 0 TO 3 ' calc new point locations with rotation and zoom
    121.         x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
    122.         px(i&) = x2&: py(i&) = y2&
    123.     NEXT
    124.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
    125.     _MAPTRIANGLE _SEAMLESS(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
    126.  
    127.  
    128.  
    « Last Edit: September 27, 2020, 10:42:53 pm by FellippeHeitor »

    FellippeHeitor

    • Guest
    Re: "Among Us" Ejection Screen
    « Reply #8 on: September 27, 2020, 10:52:05 pm »
    Fine tuned:
    Code: QB64: [Select]
    1. SCREEN _NEWIMAGE(800, 600, 32)
    2.  
    3. TYPE object
    4.     x AS SINGLE
    5.     y AS SINGLE
    6.     size AS SINGLE
    7.     speed AS SINGLE
    8.  
    9. DIM SHARED star(1 TO 100) AS object
    10. FOR i = 1 TO 100
    11.     star(i).x = -_WIDTH + (RND * _WIDTH * 2)
    12.     star(i).y = RND * _HEIGHT
    13.     star(i).size = RND * 2
    14.  
    15.  
    16. start = TIMER
    17. message$ = "Player was not The Impostor."
    18.  
    19. _TITLE "Ejection screen"
    20. DIM eject AS LONG
    21. DIM crewmate AS LONG
    22. crewmate = _LOADIMAGE("crewmate (Custom).png", 32)
    23. eject = _SNDOPEN("eject.wav")
    24.  
    25. coord1 = -(_WIDTH(crewmate) * 3)
    26.  
    27.     CLS
    28.  
    29.     FOR i = 1 TO 100
    30.         IF star(i).x > _WIDTH THEN
    31.             star(i).x = -1
    32.             star(i).y = RND * _HEIGHT
    33.         END IF
    34.         star(i).x = star(i).x + star(i).size
    35.         CircleFill star(i).x, star(i).y, star(i).size, _RGB32(255)
    36.     NEXT
    37.     fadeIn = 3
    38.     IF TIMER - start > fadeIn / 2 THEN
    39.         coord1 = coord1 + map(coord1, 0, _WIDTH, 10, 4)
    40.         crewMateAngle = crewMateAngle + 2
    41.     END IF
    42.  
    43.     IF TIMER - start > fadeIn THEN
    44.         IF TIMER - lastChar > .05 THEN
    45.             IF x = 0 THEN
    46.                 _SNDPLAY (eject)
    47.                 x = 1
    48.             END IF
    49.             lastChar = TIMER
    50.             IF chars <= LEN(message$) THEN
    51.                 chars = chars + 1
    52.             END IF
    53.         END IF
    54.     END IF
    55.  
    56.     m$ = LEFT$(message$, chars)
    57.     _PRINTSTRING ((_WIDTH - _PRINTWIDTH(m$)) / 2, _HEIGHT / 2 - 8), m$
    58.     IF coord1 < _WIDTH + _WIDTH(crewmate) THEN
    59.         RotoZoom3 coord1, 250, crewmate, 1, 1, _D2R(crewMateAngle)
    60.     END IF
    61.  
    62.     IF TIMER - start < fadeIn THEN
    63.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    64.     ELSEIF TIMER - start > 8 THEN
    65.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 8, 10, 0, 255)), BF
    66.     END IF
    67.  
    68.     _DISPLAY
    69.     _LIMIT 30
    70. LOOP UNTIL TIMER - start > 10
    71.  
    72. _FREEIMAGE crewmate
    73. _SNDSTOP (eject)
    74. _SNDCLOSE (eject)
    75.  
    76. endScreen = _LOADIMAGE("among-us-defeat.jpg", 32)
    77. d = _SNDOPEN("defeat.mp3")
    78.  
    79.  
    80. start = TIMER
    81. fadeIn = 3
    82.  
    83.     CLS
    84.     _PUTIMAGE , endScreen
    85.     IF TIMER - start < fadeIn THEN
    86.         LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, map(TIMER - start, 0, fadeIn, 255, 0)), BF
    87.     END IF
    88.  
    89.     _DISPLAY
    90.     _LIMIT 30
    91.  
    92.  
    93.  
    94. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    95.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
    96.  
    97. SUB CircleFill (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
    98.     ' CX = center x coordinate
    99.     ' CY = center y coordinate
    100.     '  R = radius
    101.     '  C = fill color
    102.     DIM Radius AS INTEGER, RadiusError AS INTEGER
    103.     DIM X AS INTEGER, Y AS INTEGER
    104.     Radius = ABS(R)
    105.     RadiusError = -Radius
    106.     X = Radius
    107.     Y = 0
    108.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
    109.     LINE (CX - X, CY)-(CX + X, CY), C, BF
    110.     WHILE X > Y
    111.         RadiusError = RadiusError + Y * 2 + 1
    112.         IF RadiusError >= 0 THEN
    113.             IF X <> Y + 1 THEN
    114.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
    115.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
    116.             END IF
    117.             X = X - 1
    118.             RadiusError = RadiusError - X * 2
    119.         END IF
    120.         Y = Y + 1
    121.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
    122.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    123.     WEND
    124.  
    125. SUB RotoZoom3 (X AS LONG, Y AS LONG, Image AS LONG, xScale AS SINGLE, yScale AS SINGLE, radianRotation AS SINGLE)
    126.     ' This assumes you have set your drawing location with _DEST or default to screen.
    127.     ' X, Y - is where you want to put the middle of the image
    128.     ' Image - is the handle assigned with _LOADIMAGE
    129.     ' xScale, yScale - are shrinkage < 1 or magnification > 1 on the given axis, 1 just uses image size.
    130.     ' These are multipliers so .5 will create image .5 size on given axis and 2 for twice image size.
    131.     ' radianRotation is the Angle in Radian units to rotate the image
    132.     ' note: Radian units for rotation because it matches angle units of other Basic Trig functions
    133.     '       and saves a little time converting from degree.
    134.     '       Use the _D2R() function if you prefer to work in degree units for angles.
    135.  
    136.     DIM px(3) AS SINGLE: DIM py(3) AS SINGLE ' simple arrays for x, y to hold the 4 corners of image
    137.     DIM W&, H&, sinr!, cosr!, i&, x2&, y2& '   variables for image manipulation
    138.     W& = _WIDTH(Image&): H& = _HEIGHT(Image&)
    139.     px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
    140.     px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
    141.     px(2) = W& / 2: py(2) = H& / 2 '  right bottom
    142.     px(3) = W& / 2: py(3) = -H& / 2 ' right top
    143.     sinr! = SIN(-radianRotation): cosr! = COS(-radianRotation) ' rotation helpers
    144.     FOR i& = 0 TO 3 ' calc new point locations with rotation and zoom
    145.         x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
    146.         px(i&) = x2&: py(i&) = y2&
    147.     NEXT
    148.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
    149.     _MAPTRIANGLE _SEAMLESS(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image TO(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
    150.  
    151.  
    « Last Edit: September 27, 2020, 11:00:18 pm by FellippeHeitor »

    Offline bplus

    • Global Moderator
    • Forum Resident
    • Posts: 8053
    • b = b + ...
    Re: "Among Us" Ejection Screen
    « Reply #9 on: September 27, 2020, 11:38:46 pm »
    Hey did this game come out after C-virus? Everybody wears masks?

    FellippeHeitor

    • Guest
    Re: "Among Us" Ejection Screen
    « Reply #10 on: September 27, 2020, 11:39:34 pm »
    It's a 2018 game that rose to fame now during the pandemic. About the masks, well, they're astronaut suits.

    Offline bplus

    • Global Moderator
    • Forum Resident
    • Posts: 8053
    • b = b + ...
    Re: "Among Us" Ejection Screen
    « Reply #11 on: September 27, 2020, 11:45:01 pm »
    Spacemen? No these guys hangout at the corner

     
    Spacemen no these are guys that hangout at the corner.PNG


    Compare:

     
    At the corner.PNG



    Astronauts:

     
    astronuts.PNG


         ;-))
    « Last Edit: September 27, 2020, 11:57:00 pm by bplus »

    Offline SpriggsySpriggs

    • Forum Resident
    • Posts: 1145
    • Larger than life
      • GitHub
    Re: "Among Us" Ejection Screen
    « Reply #12 on: September 28, 2020, 01:50:55 am »
    Perfect!
    Shuwatch!