-
-
Save WuffMakesGames/2de5e9a067fad1a4450269ddade4f19b to your computer and use it in GitHub Desktop.
(Original) Celeste Classic made in 1019 compressed bytes for the 2023 Pico 1k Jam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s="ccccccccccccc00cccccccc50055000ccccc55500050000cccc5555000000cccc55555555000ccccc5555555000000ccccccc5500000055ccc5555000000055cc00550000555555cc000555005555ccc00055550555555cc0005555cc50055cc005cc55cc50777ccccccc50cc77cccccccccc77ccccccccccccccccccccccccc" | |
for i=1,#s do j=i-1 mset(j%16,j\16,tonum(sub(s,i,i),1)) end | |
function appr(v,t,a) return v>t and max(v-a,t)or min(v+a,t) end | |
function bt(v) return tonum(btn(v)) end | |
function sign(v) return v==0 and 0 or sgn(v) end | |
function solid(x,y) | |
for i=px+pl+x,px+pr+x-1 do for j=py+pt+y,py+y-1 do | |
if (mget(i\8,j\8)==12) return true | |
end end end | |
function move(s,r,v,x) | |
v1,v2,v3=_π¦π―π·[s],_π¦π―π·[r],_π¦π―π·[v] | |
v2+=v1 | |
a=flr(v2+0.5) | |
v2-=a | |
st=sign(a) | |
for i=0,abs(a) do | |
if solid(x and st or 0,x and 0 or st) then | |
v1,v2=0,0 | |
else | |
v3+=st | |
_π¦π―π·[v]=v3 | |
end end _π¦π―π·[s],_π¦π―π·[r]=v1,v2 end | |
px,py,pdx,pdy,pdrx,pdry,dsh,dshtm,pl,pt,pr=13,104,0,0,0,0,1,0,-3,-5,3 | |
jbuff,grace=0,0 | |
function _update() | |
lx,ly=px,py | |
move("pdx","pdrx","px",1) | |
move("pdy","pdry","py") | |
px=mid(px,-pl,128-pr) | |
mx,ground=bt(1)-bt(0),solid(0,1) | |
my=bt(3)-bt(2) | |
jmp,djmp,_jmp,_djmp=btn"4"and not _jmp,btn"5"and not _djmp,btn"4",btn"5" | |
jbuff,grace,dsh=jmp and 4 or jbuff-1,ground and 6 or grace-1,ground and max(dsh,1) or dsh | |
if dshtm>0 then | |
dshtm-=1 | |
pdx,pdy=appr(pdx,dtx,dax),appr(pdy,dty,day) | |
else | |
fal,pdx=mx~=0 and solid(mx,0) and 0.4 or 2,appr(pdx,mx,abs(pdx)<=1and (ground and 0.4or 0.6)or 0.15) | |
if (not ground) pdy=appr(pdy,fal,abs(pdy)>0.15 and 0.21 or 0.105) | |
if jbuff>0 then | |
if grace>0 then | |
jbuff,grace,pdy=0,0,-2 | |
else | |
wdir=solid(-3,0) and -1 or solid(3,0) and 1 or 0 | |
if wdir~=0 then | |
jbuff,pdx,pdy=0,wdir*-2,-2 | |
end end end end df,dh=5,0.5355 | |
if djmp and dsh>0 then | |
dshtm=4 dsh-=1 | |
pdx,pdy=mx~=0 and mx*(my~=0 and dh or df) or (my~=0 and 0 or pfx and -1 or 1),my~=0 and my*(mx~=0 and dh or df) or 0 | |
dtx,dty=2*sign(pdx),(pdy>=0 and 2 or 1.5)*sign(pdy) | |
dax,day=pdy==0 and 1.5 or 1.0607,pdx==0 and 1.5 or 1.0607 | |
end end | |
function dpyr(x,y) rectfill(x+pl,y+pt,x+pr-1,y-1,dshtm>0 and 7 or dsh>0 and 8 or 12) end | |
function _draw() | |
cls() | |
for x=0,120,8 do for y=0,120,8 do | |
rectfill(x,y,x+7,y+7,mget(x\8,y\8)) | |
end end | |
dpyr(lx,ly) | |
dpyr(px,py) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment