Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
A jam submission

1K Snow GlobeView game page

Somewhat Realistic Snow Globe
Submitted by Jenny Schmidt (bikibird) — 2 days, 21 hours before the deadline
Add to collection

Play Fidget Toy

1K Snow Globe's itch.io page

Compressed Bytes used
973

Source Code (OPTIONAL)
function _init()o,a={},50g,e=a*a,-a camera(-64,-64)d={0x71.717,1905.06823,0x7.17,1809.06676,0x7.17,1905.06823,0x71.717,0,0x71.717,1905.44323,0x7.77,1911.46666,0x7.77,1905.44323,0x71.717}for n=0,15do poke4(n*64,d[n+1])end for n=1,150do add(o,c())end b,i,x,l,j=.02,0,0,0,0n(1.33)end function n(n)l+=n u,h=1/l,1-1/l end function _update60()if(btnp(⬆️))n(.01)
if(btnp(⬇️))n(-.01)
if(btnp(🅾️))i-=2x=rnd{-.01,.01}
if(btnp(⬅️))x-=-.01
if(btnp(➡️))x+=.01
for n in all(o)do local o,e,l,c,d=n.x,n.y,n.z,j local c=atan2(o,l)local f=o*cos(c)+l*sin(c)o,l=f*cos(c+x),f*sin(c+x)d=n.dy+i+b e+=d if(s(o,e,l)<a)local c,f=w(o-3.5,e-3.5,l)local a,i=w(o+3.5,e+3.5,l)n.x,n.y,n.z,n.x0,n.y0,n.width,n.height,n.dy=o,e,l,c,f,abs(c-a),abs(f-i),d else if(e>0)n.dy=0else n.dy=-d
end i*=.9x*=.99f=i>1and i*rnd{3,-3}\1or 0r=i*5for n=1,#o do local n=n while(n>1and not(o[n-1].z>o[n].z))o[n],o[n-1]=o[n-1],o[n]n=n-1
end end function _draw()cls()for o,n in pairs(o)do local o,l,n,e,d=n.x0,n.y0,n.width,n.height,0if(abs(n)<4or abs(e)<4)d=8
local c=pget(o+n/2,l+n/2)pal(1,c~=7and c or 0)sspr(0,d,7,7,o+f,l-r,n,e)end poke(24372,2)circfill(0-f,0-r,a,6144)poke(24372,0)circ(0-f,0-r,a,3)clip(0-f,63-r,128,64)circ(0-f,0-r,a-1,3)clip()?"🅾️",-3,56,3
?"⬅️",-25,56,3
?"➡️",19,56,3
?" ⬆️\n\n"..sub(tostr(l),1,4).."\n\n ⬇️",-64,-64,3
end function w(d,c,f)local o,l,e=-d,-c,e-f local n=s(o,l,e)o,l,e=o/n,l/n,e/n n=-d*o-c*l-f*e local e,f,a=d+o*n,c+l*n,f+e*n n=sqrt(g-e*e-f*f-a*a)return u*d+h*(e-o*n),u*c+h*(f-l*n)end function c()local n,o,l=rnd(a-1),rnd(),rnd()local n,o,l=n*sin(o)*cos(l),n*sin(o)*sin(l),n*cos(o)return{x=n,y=o,z=l,x0=n,y0=o,width=1,height=1,dy=0}end function s(n,o,l)local e=atan2(n,o)local n=n*cos(e)+o*sin(e)local o=atan2(n,l)return n*cos(o)+l*sin(o)end

Leave a comment

Log in with itch.io to leave a comment.

Comments

Developer

Updated to fix some bad math and added adjustable refraction index.