1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- -- title: fireworks test
- -- author: pixelbath
- -- desc: description
- -- script: lua
- t=0
- color_fuse = {12,4}
- colors = {
- {3,2,1},
- {7,6,5},
- {11,10,9},
- {15,14,13},
- }
- seeds = {}
- function add_firework_seed(xpos)
- table.insert(seeds, {
- vel_y = -1 + (math.random() * -1),
- startx = math.random(240),
- color = math.random(3)+1,
- x = xpos, y = 136,
- })
- end
- function fireworks_update()
- local delete_seeds = {}
- for i = 1, #seeds do
- local this_seed = seeds[i]
-
- this_seed.vel_y = this_seed.vel_y + 0.012
- this_seed.y = this_seed.y + this_seed.vel_y
- pix(this_seed.x, this_seed.y, this_seed.color)
- -- reaching the apex
- if this_seed.vel_y > -0.1 then
- if math.random() > 10 * math.abs(this_seed.vel_y) then
- spawn_explosion(this_seed.x, this_seed.y, this_seed.color)
- table.insert(delete_seeds, i)
- end
- end
- end
- for i = #delete_seeds, 1, -1 do
- table.remove(seeds, delete_seeds[i])
- end
- end
- function spawn_explosion(xpos, ypos, color)
- end
- add_firework_seed(50)
- function TIC()
- if btn(0) then y=y-1 end
- if btn(1) then y=y+1 end
- if btn(2) then x=x-1 end
- if btn(3) then x=x+1 end
- cls(0)
- fireworks_update()
- t=t+1
- end
- -- <WAVES>
- -- 000:00000000ffffffff00000000ffffffff
- -- 001:0123456789abcdeffedcba9876543210
- -- 002:0123456789abcdef0123456789abcdef
- -- </WAVES>
- -- <SFX>
- -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
- -- </SFX>
- -- <PALETTE>
- -- 000:1a1c2c610018da3038fa484ceec2612cce50108540083c2404366f042c79045dda1085fff4f4f42c0038690071a508b2
- -- </PALETTE>
|