Advertisement
ForrestFox

Fireworks

Mar 21st, 2021
230
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SCREEN 13
  2.  
  3. TYPE pt
  4.   x AS SINGLE
  5.   y AS SINGLE
  6.   sx AS SINGLE
  7.   sy AS SINGLE
  8.   lt AS SINGLE
  9. END TYPE
  10.  
  11. DIM fp(0 TO 320) AS pt
  12.  
  13. ' Palette
  14. FOR i = 1 TO 31
  15.   OUT 968, i
  16.   OUT 969, 2 * i
  17.   OUT 969, 0
  18.   OUT 969, 0
  19. NEXT
  20.  
  21. FOR i = 0 TO 31
  22.   OUT 968, 32 + i
  23.   OUT 969, 63
  24.   OUT 969, 2 * i
  25.   OUT 969, 0
  26. NEXT
  27.  
  28. DO
  29.  
  30.   nfree = 0
  31.  
  32.   ' Fade
  33.   DEF SEG = &HA000
  34.   FOR i = 0 TO 63999
  35.     v% = PEEK(i) - 2
  36.     IF v% < 0 THEN v% = 0
  37.     POKE i, v%
  38.   NEXT
  39.   DEF SEG
  40.  
  41.   ' Processing
  42.   FOR i = 0 TO 320
  43.  
  44.     IF fp(i).lt > 0 THEN
  45.  
  46.       PSET (fp(i).x, fp(i).y), INT(fp(i).lt)
  47.       fp(i).x = fp(i).x + fp(i).sx
  48.       fp(i).y = fp(i).y + fp(i).sy
  49.       fp(i).sy = fp(i).sy + .01
  50.       fp(i).sx = fp(i).sx * .995
  51.       fp(i).lt = fp(i).lt - .25
  52.  
  53.     ELSE
  54.  
  55.       fp(i).lt = 0
  56.       nfree = nfree + 1
  57.  
  58.     END IF
  59.  
  60.   NEXT
  61.  
  62.   ' Create new burst
  63.   IF nfree > 160 THEN
  64.  
  65.     rx = RND * 320
  66.     ry = RND * 100
  67.     FOR i = 0 TO 320
  68.  
  69.       IF fp(i).lt = 0 THEN
  70.  
  71.         v = RND
  72.         fp(i).x = rx
  73.         fp(i).y = ry
  74.         fp(i).sx = SIN(i / 320 * 6.28) * v
  75.         fp(i).sy = COS(i / 320 * 6.28) * v
  76.         fp(i).lt = 32 + RND * 31
  77.  
  78.       END IF
  79.     NEXT
  80.  
  81.   END IF
  82.  
  83. LOOP WHILE INKEY$ = ""
Advertisement
RAW Paste Data Copied
Advertisement