// script: js // shoutouts to // jtruk // boris // doop // M3RL0CKSH0LM3S (good luck with your linux endeavour!) // MutzBunny W=240 H=136 MW=W/2 m=Math sin=m.sin cos=m.cos max=m.max min=m.min floor=m.floor rnd=m.random tau=m.PI*2 function lin(x,x0,x1,y0,y1){ let t=(x-x0)/(x1-x0) return y0+t*(y1-y0) } function uf(a,b){ return lin(rnd(),0,1,a,b) } function cn(a){ return uf(-a,a) } function c(x){ return ()=>x } class P{ constructor(x,y,vx,vy,h,dec){ this.x=x this.y=y this.vx=vx this.vy=vy this.h=h this.sh=h this.dec=dec this.fr=fr } step(){ let dt=0.1 this.x+=this.vx*dt this.y+=this.vy*dt if(this.dec){ this.vx*=lin(this.h,this.sh,0,1,0.99) } this.h-- } } class E{ constructor(x,y,dir,vel,rate,h,dec=false){ this.x=x this.y=y this.dir=dir this.vel=vel this.rate=rate this.h=h this.ps=[] this.nfr=1 this.dec=dec } mirrored(){ return new E( ()=>W-this.x(), this.y, ()=>-this.dir(), this.vel, this.rate, this.h ) } step(){ if(fr==this.nfr){ this.nfr+=max(1,floor(this.rate())) let x=this.x() let y=this.y() let vel=this.vel() let dir=this.dir()+tau/2 let vx=vel*sin(dir) let vy=vel*cos(dir) this.ps.push(new P(x,y,vx,vy,this.h(),this.dec)) } this.ps.forEach(p=>{ p.step() }) this.ps=this.ps.filter(p=>p.h>0) } } er=new E( ()=>MW+cn(5), //x c(H-5), //y ()=>cn(0.3), //dir c(7), //vel c(2), //rate c(180), //h ) eo=new E( ()=>MW+cn(3), //x c(H-5), //y ()=>cn(0.2), //dir ()=>uf(5,8), //vel c(3), //rate c(160), //h ) ey=new E( ()=>MW+cn(3), //x c(H-5), //y ()=>cn(0.2), //dir c(8), //vel c(3), //rate c(150), //h ) eb1=new E( ()=>MW+30+cn(4), //x c(H-5), //y ()=>uf(-0.1,0.3), //dir ()=>uf(7,11), //vel ()=>uf(3,6), //rate c(200), //h ) eb2=eb1.mirrored() f1=new E( c(-10), //x c(H-20), //y c(-tau/4),//dir c(2), //vel ()=>uf(150,300), //rate c(3000), //h false, ) f2=new E( c(-10), //x c(H-15), //y c(-tau/4),//dir c(3), //vel ()=>uf(200,400), //rate c(3000), //h false, ) f3=new E( c(-10), //x c(H-10), //y c(-tau/4),//dir c(4), //vel ()=>uf(300,600), //rate c(3000), //h false, ) fr=0 function TIC(){ vbank(1) drive([er],12,0,2) drive([eo],10,0,3) drive([ey],4,0,4) drive([eb1,eb2],2,12,0,1.5) vbank(0) cls(0) //fire(MW*1.5,H-10,1,1) f1.ps.forEach(p=>{ s=lin(hash(p.fr),0,1,0.2,0.3) a=lin(hash(p.fr*2344),0,1,1.3,0.8) fire(p.x,p.y,s,a) }) f1.step() f2.ps.forEach(p=>{ s=lin(hash(p.fr),0,1,0.4,0.7) a=lin(hash(p.fr*2344),0,1,1.3,0.8) fire(p.x,p.y,s,a) }) f2.step() f3.ps.forEach(p=>{ s=lin(hash(p.fr),0,1,.9,1.3) a=lin(hash(p.fr*2344),0,1,1.3,0.8) fire(p.x,p.y,s,a) }) f3.step() vbank(1) cls(0) vbank(0) fr++ } function hash(f){ return (f%5000)/5000 } function fire(x,y,s,a){ let x0=x-W*s*a/2 let x1=x+W*s*a/2 let y0=y-H*s let y1=y a=[x0,y0] b=[x1,y0] c=[x1,y1] d=[x0,y1] ua=[0,0] ub=[W,0] uc=[W,H] ud=[0,H] ttri(...a,...b,...c,...ua,...ub,...uc,2) ttri(...a,...c,...d,...ua,...uc,...ud,2) } function drive(es,sr,er,col,ecc=1){ es.forEach(e=>{ e.ps.forEach(p=>{ let r=lin(p.h,p.sh,0,sr,er) elli(p.x,p.y,r,r*ecc,col) }) e.step() }) } function BDR(i){ poke(0x3fc0+0,0) poke(0x3fc0+1,0) poke(0x3fc0+2,lin(i-10,0,H,40,20)) }