-- bad fireworks alt
-- alexthescott
-- 8/24/21
p={137,142,143,135,141,13}
pal(p,1)
-- contrived oop
function add_splash()
local b={}
b.c=2+(rnd(3)\1)*2
b.sr=0
b.br=1
b.bv=0.25
b.bm=(1+rnd(4)\1)*3
b.x=rnd(128)
b.y=rnd(128)
b.update=function(s)
s.sr+=1
if s.br>s.bm then
s.bv=-0.25
elseif s.br<=0 then
s.bv=0
end
s.br+=s.bv
end
b.draw=function(s)
circ(s.x,s.y,s.sr,b.c)
if s.bv!=0 then
circfill(s.x,s.y,s.br,b.c)
end
end
b.destroy=function(s)
if s.bv==0 and s.sr>181 then
del(splash,s)
end
end
add(splash,b)
end
-- set btn delay
poke(0x5f5d, 30)
splash={}
add_splash()
cls()
::♥::
-- burn pixels
for p=0,2048 do
px=rnd(128)
py=rnd(128)
pc=pget(px,py)
if pc!=0 and pc%2==0 then
if rnd(2)\1==0 then
pset(px,py+1,pc)
pset(px,py+2,pc)
end
pset(px,py,pc-1)
else
pset(px,py,0)
end
end
if t()<2 then
print("bad fireworks alt",30,64,1)
else
-- little boom
if t()%3==0 then
add_splash()
end
-- 40 sec 'big' boom
if t()%40==0 then
for i=1,10 do
add_splash()
end
end
-- diy boom
if btnp(4) or btnp(5) then
add_splash()
end
-- object loop
for s in all(splash) do
s:draw()
s:update()
s:destroy()
end
end
flip()
goto ♥