Genuary 2024 Day 1 - Particles, lots of them

January 01, 2024
pico-8 open-source
Genuary 2024 Day 1 - Particles, lots of them
-- genuary #1 2024
-- particles, lots of them
-- by carson kompon
?"\^!5f10▒1😐<"
g=128a={}b={}f=0r=rnd
_set_fps(60)

::_::
	cls()
	f+=1
	
	if f%60==0 then
		add(a,{r(g),r(g),r(1),r(2)-1,120})
	end
	
	for e in all(a)do
		local d=e[3]+r(.1)
		e[3]+=.05*e[4]
		e[5]-=1
		if(f%2==0)add(b,{e[1],e[2],cos(d),sin(d),r(3)+1})
		if(e[5]<0)del(a,e)
	end
	
	for p in all(b)do
		p[4]+=.04
		local x=p[1]
		local y=p[2]
		local n=x+p[3]
		local m=y+p[4]
		local l=abs(p[4]/2)
		if(n<0or n>g)p[3]*=-1
		if(m<0)p[4]=l
		if(m>g)p[4]=-l
		p[1]=n
		p[2]=m
		line(x,y,n,m,p[5])
		if(y>=g and abs(p[4])<=.04)del(b,p)
	end
	
	flip()
goto _