jonbro: "::s::" is a label definition in Lua 5.2, which you can use with "goto s". Looks like "::s::" ... "goto s" ends up being smaller than "while 1 do" ... "end". That's neat!
Yeah, first time I used a goto in a while! It's smaller even when manually flip()ing frames too.
t=0::l::cls()t+=0.01 for y=20,98,2 do circ(64+cos(t)*y,20,y/8,y)for x=0,127 do c=pget(x-1,y)+pget(x+1,y)pset(x,y+2,c%3) end end flip()goto l |
i am seriously humbled by your collective brilliance
i submit a very basic sinewave lollipop graph
t=0 while 1 do t+=.03 for x=0,16 do y=64+sin(x/20+t)*16 x8=x*8 line(x8,64,x8,y,7) circ(x8,y,2,7+rnd(8)) end flip()cls()end |
[edit]
aright this got creepy
still fits in a tweet though!
t=0 while 1 do t+=.03 for x=0,16 do y=64+sin(x/20+t)*16 x8=x*8 circfill(x8,y,(y/25+y/5),1+x%15) end flip()cls()end |
[more edits]
sawtooth lollipop graph!
fits PRECISELY in 140 characters, including formatting :)
m=64 f=0 while 1 do for x=0,16 do f+=440 y=(f%m) x8=x*8 line(x8,64,x8,y+32,7) circ(x8,y+32,2,x) end flip() cls() end |
UPDATED AGAIN: more efficient line usage, added some colour and detail.
UPDATED: added some more detail and less chance it messes up. Exactly 140!
First ever Pico8 'thing'. I did a tunnel-esque one but didn't like it, so here's the beginnings of Mini-DownWell... or something :p
x=32q=122p=print a=rnd function _draw() for i=0,x,2 do p("@",i,q,4)p("@",q-i,q) end p(".",a(q),q)p"" u=a(5)d=a(5) x=max(min(32,x+u-d),0) end |
i wrote this silly thing. sadly i could've made it alot better with like 5 more chars haha.
x={}for i=1,16 do x[i]=flr(8+rnd(4))end for i=1,16 do for j=1,16 do n=2 y=x[i] if y<j then n=3 end if y>j then n=1 end spr(n,i*8,j*8)end end |
cls() a={} b={} ::s:: add(a,rnd(128)) add(b,rnd(128)) for i=1,#a do circ(a[i],b[i],1,i%3+8) a[i]+=rnd(6)-3 b[i]+=rnd(6)-3 end flip() goto s |
@zero01101 riffin on lollipops!! 136 characters
t=0 while 1 do t+=.03 for x=0,16 do y=64+sin(x/20+t)*20 b=x*8 line(b,64,b,y,5) circ(b,y,1+abs(y-64)/3,x) pset(b,y,7) end flip()cls()end |
i wrote this silly thing. sadly i could've made it alot better with like 5 more chars haha.
|
You can get a few more chars with the help of PICO-8 Lua shorthand and parser permissiveness:
x={}for i=1,16 do x[i]=flr(8+rnd(4))end for i=1,16 do for j=1,16 do n=2y=x[i] if(y<j)n=3 if(y>j)n=1 spr(n,i*8,j*8)end end |
140 -> 121 characters
Edit: Also, you can abuse the fact that one of your sprites is transparent and then use the sgn() function to get it down to 112, even though it doesn't return three values like it's supposed to:
x={}for i=0,15 do x[i]=flr(8+rnd(4))end for i=0,15 do for j=0,15 do if(j!=x[i])spr(2+sgn(x[i]-j),i*8,j*8)end end |
If sgn(0) returned 0, like it's supposed to, you could skip the if(j!=x[i]).
Zep, I'm looking at you. cough
dodger - You're a helpless X, dodge the other X! If you die, the game crashes.
Controls: up - hold to move up, let go and you'll fall
Just barely fits in 140 characters, uses gotos, and takes advantage of the fact that sprite 0 is an x in new cartridges.
y=4 z=0::a::z=rnd(8)x=99::s::cls()y=mid(0,y-(btn(2)and.3 or-.3),8)spr(0,0,y*9)spr(0,x,z*9)x-=3 if(x>0)flip()goto s if(abs(y-z)<.7)d() goto a |
edit: slightly more playable
140 on the nose (updated for Better Styles)
t=0 function _draw() cls() t+=.03 for x=0,32 do r=64-sin(x/32+t)*16+cos(t+t*0.5)*17 b=x*4 rect(b,64,b+1,r,7+x/4) rect(b,r,b+1,r-1,7) end end |
cls()o=15::s:: for i=0,99 do x=rnd(128)y=rnd(128) c=pget(x,y)+o circfill(x+rnd(6)-3,y+rnd(6)-3,5,c) end o*=0.7 flip()goto s |
I wanted to write a real game for the jam, and I settled on janken, a.k.a. jankenpon, a.k.a. rock-paper-scissors. Alas, I could not trim it down enough to qualify for a tweet. It's 248 chars. I'm disqualifying myself, but I want to share it anyway.
How to play:
L, U, R on the dpad are the moves. L < U, U < R, R < L. All legal moves beat illegal moves like D, X, or O. Ties do not count.
To start, throw any move at the first single button prompt. Say "Pi!" out loud!
To continue, throw any move again at the second single button prompt. Say "Ko!" out loud!
To complete the game, throw your real move at the triple button prompt. Say "PON!" out loud!
Your and the AI choice will be display, along with culmulative scores. Hit any button to start the next round.
Note that it does have an actual AI that does more than RND(3). It's simple, but it's not half bad. I'm curious how well it does against people. No peeking at the code first!
Speaking of the code, this is what you're meant not to peek at:
I SAID DON'T PEEK! GO PLAY FIRST!
function p(s)print(s)repeat b=btn()until b!=0 repeat until btn()==0 end w=0 l=0::r::a=flr(g or rnd(3))+1 g=nil p("L!")p("L!")q="LUR?"p(q)u=({1,3,4,2})[b]or 4 if(a!=u)d=(u-a)%3%2 w+=d l+=1-d g=(a-1-d+rnd(1.3))%3 p(w..sub(q,u,u)..sub(q,a,a)..l)goto r |
(Note that in the actual code, LUR is replaced with the corresponding arrow icons, which don't copy/paste correctly.)
This uses sprites, but I wanted to do something with the map.
f=0 function _draw() f+=1 if f==8 then f=0 memcpy(0x2080,0x2000,2000) for x=0,127 do poke(0x2000+x,flr(rnd(8))) end end map(0,0,0,-8+f) end |
press button 4
rectfill(0,0,140,140,3) while 1 do a=1 if(btn(4))a=3 for i=0,a do x,y=rnd(140),rnd(140) circfill(x,y,a,pget(x,y)*a) end end |
123 characters I think
First thing I've ever made with pico 8, it was a lot of fun!
cls()for x=0,127 do for y=0,127 do s=0t=0 for i=1,19 do u=s^2-t^2+x/60-1.6t=2*s*t+y/60-1s=u if(s^2+t^2>4)pset(x,y,x^5/99-y/9)end end end |
@lynn: WOW O_O
ok trying a more satisfying etchasketch config - exactly 140c
cls() x=9y=9t=0 function _draw() if(btn(0))x-=1 if(btn(1))x+=1 if(btn(2))y-=1 if(btn(3))y+=1 t+=0.05 circfill(x%127,y%127,rnd(3),6+t%10) end |
x=0y=0::s:: if(btnp(4)) then cls()x=64y=64 end x+=1-rnd(2) y+=1-rnd(2) a=10-rnd(20) b=10-rnd(20) line(x,y,x+a,y+b,rnd(16)) x+=a y+=b goto s |
whoa
Experimented with some ideas I saw from PixzleOne, to sample existing screen pixels with pget(), this gives pretty interesting results! got some weird Dr. Mario colors going on here
EDIT:
whoops, here's the code:
::a::for i=1,99 do x=rnd(128)y=rnd(128)rect(x,y,x+2,y+2,pget(rnd(128),64)/.8)end print('whoa',58,64,7) flip()goto a |
EDIT 2:
there was a redundant counter variable j, I've removed it from the code snippet because doesn't affect anything
::a:: pset(rnd(128),rnd(128),5+rnd(3)) goto a |
this doesn't even deserve a cart but it's really effective static
Every day is a good day when you paint.
cls() x=64y=64t=0::s:: t=rnd(.4) x+=t-rnd(t*2) y+=t-rnd(t*2) x%=128 y%=128 circ(x,y,1,7+(x*y)*.00056%8) print("bob ross",95,120,0) goto s |
@zero01101 can even be a one-liner!
::a::pset(rnd(128),rnd(128),5+rnd(3))goto a |
@Overkill - i love how if you remove the seed "whoa" from the algo that it burns itself out really fast! that was weird + unexpected <3
I'm just getting started with Pico-8 and wanted to try this since everyone else was making such cool rainbowy things! (140 characters)
t=0 function _draw()cls() for y=40,140 do for x=0,127 do b=999/y*sin(.01*x-.05*t)pset(x,y+b*sin(.02*x-t),rnd(y*.02)+y/7) end end t+=.1 end |
t=1 while 1 do t+=.000016 circ(64+cos(t)*50,64+sin(t/3)*50,1,15) x=rnd(127) p=pget(x,x) if(p)then circ(x,y,rnd(4),p*.99) end end |
my first pico-8 thing, yay!
t=0 x=0 y=0 while true do t+=0.05 x+=1 y=0+sin((t+x)/128)*128 pset(x%128,y%128,sin((y%x)/256)*4) end |
this jam is the best
I made bubble sort in 139 characters!
a={} for i=0,99 do a[i]=rnd()*99 end function _draw()cls()for k=0,98 do if (a[k]>a[k+1])t=a[k] a[k]=a[k+1] a[k+1]=t line(k,0,k,a[k])end end |
POWER ORB - fun with polar coordinates! Every particle entity starts at a random angle with a fixed radius away from the center of the screen, and every frame decreases each the particle's radius. When a particle hits radius 0, it is removed. You can remove that del if you want stuff to cross through the origin, which looks kinda neat -- but I sorta liked having everything contained in a circle around the center.
t={}w=64::a::add(t,{w,rnd(),rnd(16)})for e in all(t)do r=e[1]a=e[2]pset(sin(a)*r+w,cos(a)*r+w,e[3])e[1]=r-1 if(r<0)del(t,e) end flip()goto a |
GEM SLUG: you are a slug, you are hungry, you must collect gems. There is no scoring, and you more really slow. Also, to reduce code size on the randomization, the gems share the same x and y. Anyway, have fun!
(Unlike my previous 140-character game, this one resets itself "nicely" when you collide with the other object)
Controls: arrow keys = move
x=64y=64 a=x d=.5::l::pset(x,y,3)pset(a,a,9)b=btn d*=-1 if(b(d+.5))x+=d if(b(d+2.5))y+=d if((a-x)^2+(a-y)^2<1)cls()a=rnd(99)+9 flip() goto l |
Adding more waves to the ocean.
q=135 t=0::s::cls()t+=1 for x=0,q,9 do for y=0,q,9 do a=x+5*sin((t+y-x)/q)b=a-x+y for i=1,5 do circ(a,b,i,x+y+i+t)end end end flip()goto s |
REFLEX MASTER: Press the button, quickly! Each button press counts towards your score, but your score resets when the time runs out. The difficulty increases slightly with each button, and eventually becomes impossible to win.
(A high score thing and better difficulty curve would nice, but with only 140 characters not much you can do.)
p=0::a::n=rnd(6)+1 t=70-p::b::flip()cls()t-=1 if(t>20 or t%2<1)print(sub('������',n,n)..' '..p) if(btnp(n-1))p+=1 goto a if(t>0)goto b run() |
Those characters are the button codes btw (LRUDOX), not sure if the BBS will display them. I noticed the pico-8 0.1.8 text editor's scrolling breaks with long lines of button code strings, and won't scroll the viewport to the right fully.
@Retronator - tip: You can swap variables much more easily in Lua:
a,b = b,a |
No need for a temporary. :)
Animated water tiles. Fills an 8x8 tile with 1 bg color pixel + 1 white pixel every frame, to make a semi-convincing water tile. The logic done by sset could be useful for someone's top-down game if they don't want to draw a tile, just remove the color cycling on the bg color.
cls()t={12,6,9,15,14,11}memset(8192,1,4096)c=0::a::sset(rnd(8)+8,rnd(8),t[flr(c)%#t+1])sset(rnd(8)+8,rnd(8),7) map()flip()c+=.005 goto a |
I tried compressing Tron, but I ended up having to make it singleplayer and useless, and it still isn't even 140 characters. Oh well.
cls() x=64 y=64 d=0 function _update() if(btnp(0))d-=1 if(btnp(1))d+=1 if(d<0)d=3 if(d>3)d=0 if(d==0)x+=1 if(d==1)y+=1 if(d==2)x-=1 if(d==3)y-=1 if(pget(x,y)==8)cls() end function _draw() rect(x,y,x,y,8) rect(0,0,127,127,8) end |
I managed to do something slightly interactive.
Press Z to increase bubbles' radius.
t=0 r=1 ::a::cls() for y=0,128,8 do for x=0,128,8 do c=flr(rnd(16))circ(x,y,abs(5-sin(t)*r),c)end end t+=.01 if(btn(4))r+=.2 flip() goto a |
This was small enough to tweet with #pico8 hashtag and a gif
t=0::s::z=cos(t)*32+40 t+=0.01 w=64 for y=-w,w do for x=-w,w do pset(x+w,y+w,bxor(x/z,y/z)%2+1)end end goto s |
::s:: for i=0,3000 do x=rnd(127) y=rnd(127) c=pget(x,y) if c>0 then circ(x,y,1,8+(c+rnd(99)/98)%8) end end flip()goto s |
x=64y=40q=0.25_=128r=-q::g:: if(btnp(0))r-=q if(btnp(1))r+=q x+=sin(r) y+=cos(r) if(pget(x%_,y%_)!=0)cls() pset(x%_,y%_,8+4*r%8)flip()goto g |
140/140
Building on from linky00's Tron idea. Replaced the edges with wraparound and also made the color cycle every time you make a turn.
cls() x=3 y=3 function _update() if(btn(0)) x=-1 if(btn(1)) x=x+1 if(btn(2)) y=y-1 if(btn(3)) y=y+1 rect(64-x,64+y,64+x,64+y, rnd(16)) end |
No one can escape the grid. No one.
n=15 w=127 t=0::s::cls()t-=.5 for i=0,n do z=(i*n+t%n)y=w*n/z+32 line(0,y,w,y,8)v=i+t%n/n-n/2 line(v*9+64,40,v*60+64,w,8)end flip()goto s |
t=0 while true do cls() t+=0.002 for i=0,128 do x=sin(t)*128 y=-x z=sin(t+y/128)*64+(i+x)%128 rect(z,z,128-i,(i+x)%128,i/8) end flip() end |
t=0 while 1 do cls(0) t+=.01 for i=0,127 do x=sin(t+i/32)*7 y=cos(t+i/96)*128 line(y*i+x,(i+y)%128,(128-i-y)%128,(i+x)%128,i/13) end flip() end |
t=0 while true do cls() t+=.002 for i=0,127 do x=sin(t)*128 y=-x line((i+x)%128,(i+y)%128,(128-i-y)%128,(i+x)%128,sin(t+i/8)) end flip() end |
and here's a bonus failed one which i couldn't shrink enough & still have it looking how i wanted..
t=0 while true do cls(0) t+=0.002 for i=0,127 do x=sin(t)*128 y=cos(t)*128 if i%6<2 then rect((sin(t+y/128)*64)+(i+x)%128,(cos(t+x/128)*64)+(i+y)%128,(128-i-y)%128,(i+128+x)%128,5+(i/16)%3) end line((sin(t+y/128)*64)+(i+x)%128,(cos(t+x/128)*64)+(i+y)%128,(128-i-y)%128,(i+128+x)%128,7+(i/8)%8) end flip() end |
fireball effect
r=rnd::s::n=128 for i=0,n do x=1 for j=0,n do c=pget(i,j) if(c>0)pset(i+r()-.5,j+r()-.5,c/2)x=_ end if(x)circfill(r(n),r(n),7,9) end goto s |
[Please log in to post a comment]