better etchasketch! ~118 characters (110 w/o clear-screen or random color)
cls() x=0 y=0 while 1 do if(btn(0)) x-=1 if(btn(1)) x+=1 if(btn(2)) y-=1 if(btn(3)) y+=1 pset(x,y,7+rnd(9)) flip() end |
t=0 while true do t+=1 cls(1) for x=0,63 do for y=0,63 do pset(x*2+y%2,y*2,8+(t/16+((x-32)/(y-32)))%8) end end flip() end |
Cool!
You can just do "if(btn(0))x-=2", btw!
I'll have to try making something like this too, haha.
Also, thanks for retweeting my thing the other day!
ok here's a weird version of the etchasketch that makes a fat worm thing
cls() x=0 y=0 while 1 do if(btn(0)) x-=1 if(btn(1)) x+=1 if(btn(2)) y-=1 if(btn(3)) y+=1 circ(x,y,rnd(6),7+rnd(9)) flip() end |
0 chars left.
cls() x=0y=0 while 1 do if(btn(0))x-=1 if(btn(1))x+=1 if(btn(2))y-=1 if(btn(3))y+=1 circfill(x,y,sin(time())*3+5,7+sin(time())*5) flip() end |
Alternatively:
cls() x=0y=0t=0 while 1 do t+=.03 if(btn(0))x-=1 if(btn(1))x+=1 if(btn(2))y-=1 if(btn(3))y+=1 circfill(x,y,sin(t)*3+5,7+sin(t)*5) flip() end |
whoa thats fuckin righteous :D love it! creates freaky noby noodles <3 so good
uploaded a cart of it!
im trying to shave 70 characters off of this:
p={0x00,0x50,0x05,0x56,0x65,0x66,0x76,0x77} t=0 t+=0 cls() for x=0,64 do for y=0,120 do c=p[flr((rnd(4)+4-(((x - 32)^2+(y/2 - 28)^2))/(abs((64-t%128))+192))+1)] poke((0x6000+x+(y*0x40)), c) end end flip() |
also, it seems to run only once then quit, so I might not understand how the first program in this thread works :P
edit - aaah I have to put the "while" to keep it going :P
edit edit - I also dont need to flip because im poking
t=0 function _draw() cls()x=64 y=64 r=1 a=0 for i=0,150 do circfill(x,y,r/2,6+i%3) x+=cos(a)*r y+=sin(a)*r r+=1/4 a+=t/5 end t+=0.001 end |
flip() is being called inside a while loop to draw the backbuffer to the screen. i havent actually counted characters to see if "while 1 do // flip() end" is less than the more proper "function _draw() // end" - they're pretty close so probably not saving much at this point?
ok i just counted and function _draw() saves 1 character!
trust zep to do it right <3
UPDATE - if you don't have to call flip() (because poke, memset, etc) then its def less space to just do "while 1 do /**/ end"
haha static all over today :p
p={0x00,0x50,0x05,0x56,0x65,0x66,0x76}t=0 while 1 do t+=0 for x=0,63 do for y=0,127 do poke((0x6000+x+(y*0x40)),p[flr(rnd(7))])end end end |
Oh, Mozz yours looks much more authentically static than mine!
yea im expecting a lot of rnd based screensavers for this, button input just dominates your code otherwise. i wanna try some one-button stuff tho, thats at least interactive and still leaves lots of code space...
like these programs that just go straight to the front buffer too :D LIVIN LIFE ON THE EDGE
hmmm
how close can i get to canabalt-esque runner
here's a little jumping circle hmmmm
x=-4y=0j=0 function _draw() cls() if(btnp(2))j=-10 j+=1 y+=j y=min(99,y) circfill(10,y,4,11) x-=2 if(x<-4)x=99 circfill(x,99,4,12) end |
updated to add a little obstacle hrrmmm
would be more efficient to make it run upside down haha
kind of a proto-Helicopter in 139c
x=-4y=64r=0 function _draw() cls() y+=1 if(btn(2))y-=2 circfill(10,y,3,11) x-=2 if(x<-4) then x=123r=10+rnd(108) end circfill(x,r,9,12) end |
while 1 do print("") for i=0,3 do z=time() t=sin(z-i*.25)*4 camera(0,sin(t/180)*50) circfill(64+sin(z+i*.15)*55,100,t+7,10+t) end flip() end |
s=-9 function _update() c1=flr(rnd(16)) if btn(4) and c1==8 then s+=1 end end function _draw() cls() print("<3",60,s,8) circ(64,64,9,c1) end |
Taking a stab at this with something super simple. When the circle and heart are the same color, press the button(4) and they come together... or just hold the button down.
This thread is absolutely lovely so I made this.
function _draw() for x=0,127 do for y=0,127 do c=pget(x-2,y-2) if c>0 then c+=flr(rnd(9)/8) pset(x+rnd(3)-1,y+rnd(3)-1,c) end end end end |
a=64 camera(-a,-a)b=1 c=1 t=0 function _draw() for i=0,16 do d=(t/4+i*8)%128 line(a*b,a*b-d*b,a*c-d*c,-a*c,i)b=-b if(b<0)c=-c end t+=1 end |
138/140
nothing fancy
pretty cool thread
t=0 bt=1 c=0 l=127 while 1 do bt+= (btn(4) and 2 or -1) for t=1,l do c=1+(bt+t/5)%15 line(t,0,l-t,l,c) line(0,l-t,l,t,c) end flip() end |
hold <z> to reverse the rotation
135/140
while 1 do t=time() s=(sin(t/5)+1)/2*40 memcpy(24576,24643,8128) memset(32704,0,64) line(s,127,128-s,127,s+sin(t*(t*.001))*6) flip() end |
Here's another:
b=0 l=99 a={7,6,5,0} function _draw() b+=.5 for t=1,l do c=flr(1+(b+t/4)%#a) p=(b+t)/30 circfill(63+4*sin(p),63+4*cos(p),l-t,a[c]) end end |
138/140
This is an awesome thread so I thought I'd join in. This is just drawing a line between points on two circles rotating at different speeds. 134/140 chars.
cls() t=0 c=1 while 1 do m=64 x=30*cos(t) y=30*sin(t) z=60*cos(1.5*t) w=60*sin(1.5*t) line(m+x,m+y,m+z,m+w,c) t+=0.00003 c+=0.0003 end |
i=0 function _draw() i+=.01 y=24576 memcpy(y,y+(sin(i/3)+sin(i))*4,7200) for t=y+7296,y+8190,2 do memset(t,rnd(2)+i,2) end end |
127 characters
I've been loving going through these experiments! I started fooling around with drawing circles of different sizes and colours with small random offsets and ended up with a thing that looks like a cartoon smoke trail for fireworks or something. :)
cls() x=64 y=64 c=7 s=7 function _draw() x=(x+rnd(6)-3)%128 y=(y+rnd(6)-3)%128 c=(c+rnd(2)-1)%16 s=(s+rnd(2)-1)%12 circfill(x,y,s,c) end |
136 chars
i=0 function _draw() i-=1 for x=0,37,.5 do for y=0,11,.1+x%1 do pset((i+x*3)%128,23+y*8+sin((x+i)/50)*5,pget(x,y)) end end end |
127 characters.
Great idea using the system logo. :)
I played around a bit to see if I could get the character count down. I had to change the look a bit, but technically you can get a similar effect in 99 chars if you use this and don't hit enter. :)
i=0 function _draw()i+=1 for a=0,6559 do poke(a+25698,pget((a+i)%64,sin((a-i)/64)+a/512)*17)end end |
If you wanna be a stickler for formatting, the prettified code is 106 chars. :)
All credit to you for the idea, though. I'm just a relentless approximating optimizer.
i=0 n=12800 m={221,210,3,0,0,151,200,0} function _draw() i+=1 if i%4==0 then a=i/4%8+1 if(btn(4))m[a]=rnd(n) memset(n,m[a],n) sfx(1) end end |
140 characters.
WARNING, if you download this: This code has the absolute nerve to go overwriting a heap of RAM that it doesn't need to, and usually makes PICO-8 unusable afterwards. If you do run it... once you've hit escape, you can blindly type "reboot" and hit enter to reset.
This one extends on the idea above where we generate SFX on the fly. This loops over an array of 8 SFX setups, on loop. If you press Z during the moment an SFX starts to play, the setup for it will be randomised. So basically you build up a whacky beat by pressing Z at appropriate moments.
That's some impressive looking optimisation!
t=0 function _draw()cls(2)t+=0.01 for k=0,16 do for n=1,9 do h=k/16+t circ(64+cos(h+t/3)*n*8,64+sin(h)*(n*n+cos(t)*16),n,11-n/3)end end end |
129/140
poke(24364,7) t=0 while 1 do x=20*cos(t) y=20*sin(t) z=50*cos(0.3*t) w=50*sin(0.3*t) line(30+x,30+y,30+z,30+w,t*2) t+=0.00003 end |
function _draw()p={1,1,13,12,14,15,7}cls()srand(0) for i=0,256 do z=flr(i/40+1)circfill((rnd(128)-time()*z*z)%140-8,rnd(128),z,p[z])end end |
A bit lame but I thought I'll join you!
for i=12868,12935 do poke(i,i)end sfx(1)c=0 poke(24364,7)function _draw()cls()for i=49,95 do circ(cos(c+i/43)*i,c^4,i,i%8+8)end c-=0.003 end |
[Please log in to post a comment]