A one-evening pico-8 toy for #tweettweetjam, in 555 characters of source code.

  • Use the arrow keys to move an attractor.
  • 🅾️ (Z on most keyboards) to select a different attractor.
  • ❎ (X on most keyboards) to adjust size.

Source code:

c=circfill h=1x=0w=1e={25,89,55}f={80,68,20}g={8,3,6}p={}for i=1,5do p[i]={}end function _update() b=btn()e[h]+=b%4\2-b%2f[h]+=b%16\8-b%8\4g[h]+=w*(b%64\32)if(btnp(4))h+=1 if(h>#e)h=1 if(abs(g[h])>15)w=-w g[h]+=w for n=1,80 do if(x<1or#p[5]>300)x=1y=59+rnd(8)u=2v=0deli(p,1)p[5]={} x+=u y+=v add(p[5],{x,y})for i=1,#e do k,l=e[i]-x,f[i]-y m=g[i]/sqrt(k^2+l^2)/4a=atan2(l,k)u+=m*sin(a)v+=m*cos(a)end end end function _draw()cls(1)for i=1,#p do if(i<=#e)c(e[i],f[i],abs(g[i]),sgn(g[i])+1) for j=1,#p[i] do q=p[i][j]pset(q[1],q[2],i%8+7)end end c(e[h],f[h],1) end

StatusReleased
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
Authoricegoat9
Made withPICO-8
TagsGravity, PICO-8, toy, tweetjam, tweettweetjam
Average sessionA few minutes

Comments

Log in with itch.io to leave a comment.

This is so neat, I love the neon particle trail effect. Can make some cool looking patterns.

Once of my attractors got stuck at maximum repulsion, just vibrates when I press the button.

(1 edit)

Thanks! Ah, and now I see a bug in the attractor resizing-- I'll have to figure out if I can fix it within the 5 characters I have left...

Basically, when the attractor is at max size it changes the direction of what the resize button does-- but if you happen to stop resizing exactly at max size, it sits there changing direction back and forth 60 times a second, so you only have a 50/50 chance of hitting the resize button on the right frame to break out of that loop vs. further growing it.

Update: I think this is fixed now. 560/560 characters used.

Nice fix!