Log In  

Cart #bubblecat-2 | 2021-11-20 | Code ▽ | Embed ▽ | No License
3

welcome back, bubble cat. we have another situation, and this time you've only got 60 seconds

how to play:

  • arrow keys: move
  • ctrl-m: mute
  • X/Z: continue to next level

you don't have to full-clear every level! skipping a level without clearing it just gives you a points penalty (-5 per remaining bubble)

code:

this game was made to fit inside two tweets; i.e. <560 characters of code and no sprites! here's the full code:

x=3y=3o={}m=0n=0p=circfill::_::z={}for j=1,13do
z[j]=rnd(49)\1end?"⁶!5f2cC"
while t()<60do?"⁶1⁶c"
b=btnp()q=b>8and"⁷fdc"d=sgn(n-m)u=x
if(n~=m)m+=d d+=6
p(32,32,60-t(),1)v=y?"⁶w⁶t"..m,24,27,4+d
if(b%16>0)s=b*.5938&.75
if(not r)r,s=s
if(r)x+=cos(r)y+=sin(r)
w=x\7+y\7~=0
for j=#z,1,-1do
i=z[j]d=q and"-5"b=i\7*9a=i%7*9p(a+4,b+4,3,j|8)
if(y*7+x-x\7==i)w=del(z,i)d="+1"?"⁷d"
if(#z<1)d="+10"q="⁷egc4"
if(d)add(o,{d,a,b,d*11})n+=d
end?"★⁵8d🐱",x*9+1,y*9+3,7
if(w)x,y,r=u,v
for a in all(o)do
a[3]-=1?unpack(a)
end?q or""
if(q)goto _
end?"⁷dafa"
::e::goto e

(that's only 548 characters, but some of them (like the cat face) cost two characters on twitter. remember to ctrl-p to enter puny-text mode before pasting this into your local console!)

some code highlights:

  • convert btnp() bitfield into movement: b=btnp()if(b>0)s=b*.5938&.75if(r)x+=cos(r)y+=sin(r)
  • buffered input: if(not r)r,s=s
  • out-of-bounds check: w=x\7+y\7~=0
  • animated score display: d=sgn(n-m) if(n~=m)m+=d
  • collision checking: if(y*7+x-x\7==i)
  • draw player: ?"★⁵8d🐱",x*9+1,y*9+3,7
  • animated score floaters: for a in all(o)do a[3]-=1?unpack(a) end

full code history:

https://github.com/pancelor/bubble-cat

high score:

my high score is 207! 240! what's yours?

P#100464 2021-11-20 03:23 ( Edited 2022-01-02 20:31)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-11-30 17:15:12 | 0.007s | Q:15