Speed Pool #Pico1K
Speed Pool 1K ๐ฑ
This is my only entry (so far) to #Pico1k Jam.
It's a game of Speed Pool (with Timer), in just 1,024 bytes (1,022 chars), using NO predefined art/sfx assets! ๐
The plan was originally to try to do a demake of Arcade Pool, but quickly realised that was far too ambitious!
OBJECTIVE
- Pot all the balls (but not the white) as fast as you can!
CONTROLS
- Aim = Mouse Move
- Shoot = Mouse Click
- Tip: Farther you aim= harder the shot (but too hard & you'll fly off the table!)
- Restart Game = Browser Refresh (or Press ENTER > Reset Cart)
(Sorry, ran out of code to make nice restart logic ๐)
FEATURES
- ๐ฑ Realistic* 2D Physics
- ๏ธ๐๏ธ 60 FPS
- ๐ SFX
- โฑ "Against the Clock" action
(What's your best clearance time? ๐)
ACKNOWLEDGEMENTS
- Many thanks to PC101 for their Elastic 2D ball physics demo code
SOURCE CODE 1,024 bytes / 1,022 chars
c=circfill s=stat poke(24365,1)pal(4,0,1)l={}h=0y=0v=5for i=1,16do q=25+h*6w=y+48e=i==11and 6or(i%2)*3 if(i>15)q=99w=64e=9 b=add(l,{x=q,y=w,c=e,a=0,s=0,v=0,b=0})y+=7v-=1if(v<1)h+=1v=5-h y=h*4end _set_fps(60)while(#l>1)do m={}u=s(32)i=s(33)cls()?"\^pspeed pool \fd"..t() rectfill(0,25,127,102,3)for i=0,5do x=i*63c(x,26,5,0)c(x,101,5)end for k,b in pairs(l)do x=b.x y=b.y b.v*=.97b.b*=.97x+=b.v y+=b.b if(pget(x,y)<1)del(l,b)?"\ax3c1" for l,t in pairs(l)do a=x-t.x z=y-t.y d=sqrt(a*a+z*z) if(k!=l and d<6)add(m,{b,t})o=(d-8)/2x-=o*(a/d)y-=o*(z/d)t.x+=o*(a/d)t.y+=o*(z/d)?"\as0c" end if(x>124or x<4)b.v*=-1.1 if(y>q or y<29)b.b*=-1.1 for i=1,3do c(x+min(2-i),y+1-i,4-i,({2,8,14,9,10,7,4,4,5,6,7,7})[b.c+i])end b.x=x b.y=y end for p in all(m)do a=p[1]z=p[2]d=sqrt((a.x-z.x)*(a.x-z.x)+(a.y-z.y)*(a.y-z.y))n=(z.x-a.x)/d r=(z.y-a.y)/d v=a.v*-r+a.b*n y=z.v*-r+z.b*n o=a.v*n+a.b*r k=z.v*n+z.b*r a.v=-r*v+n*k a.b=n*v+r*k z.v=-r*y+n*o z.b=n*y+r*o end if(s(34)>0)b.v=-(b.x-u)/4b.b=-(b.y-i)/4 fillp(โ)line(b.x,b.y,u,i)fillp()flip()end
Comments
Log in with itch.io to leave a comment.
Can you repost the commented source code? Looks like the hastbin link https://hastebin.com/utituvujol.lua from the pico1k jam is down.
Thank you for letting me know (so annoyed that hastebin got acquired/ruined).
Have now re-uploaded the code here:
https://rentry.co/speed-pool-1k
42.6. i just hold mouse down and drag
Hmmm... lemme just consult the rule book ๐ค๐ฑ
#Disqualified #IDontMakeTheRules
I'm in awe Paul! Lovely visuals, and you !!!! made a whole physics engine. I think this is seriously pushing the limits. And so many smart design decisions, like the timer! Thank you!!!
Btw I'd love to see a tutorial for old-school physics engines like this. Arkanoid clones have started using box2D or whatever Unity has, and it's a big step back. These collissions are predictable enough to be enjoyable.
Anyway, I wrote too much. Love love love this entry, and thank you for hosting <3333
Wow, thank you so much for the kind words Christina! ๐
Alas, I cannot take much credit for the physics code - that was based on a great example by PC101.
(Coming up with that math from scratch would've melted my brain I think! ๐ )
I agree - sometimes somethings get lost when libraries get too advanced - it's good to appreciate how things work, than "black-box" it all.
Good idea for a tutorial though - 2Darraydid a pretty great attempt at this a while ago that I don't think I would dare attempt it! ๐จโ๐ซ
You are most welcome - thank you again and congrats again on yours & Zep's awesome entry โค
Nice gfx, nice game! This game really takes 1K of code to the limit of what's possible.
Thank you - very kind of you to say! ๐
Fun game. Keep up the good work!
Hey, thanks a lot! ๐
(for the kind words AND the video)
Outstanding!
Very impressive this!
My 7yr old Daughter did it in 178.2 seconds.
Thank you! ๐
(...and please let her know that's a very impressive time, well done! ๐)
pretty cool, good job
This is mind-blowingly good matey.
Quite addictive too. My best is 69.8 seconds.
Well done! You never cease to impress.
Thank you very much, Roy. ๐
(for the kind words AND the donation - you really shouldn't have!)
It was a lot of fun to put together - but I have to admit, I relied heavily on the collision code (referenced in details above). Don't think my maths would've managed come up with the right answer. ๐ต
The "fun" part was squeezing the well-formatted example code as small as poss! ๐
P.S. - Well done on getting a great score! ๐๐
impressive, fun AND great game feel!! <3
very cool