0+S~%SQR6_WOM'6)vw̪ vT2ܺ2Tv24TV024P 00000000 44R4:2м 2ppppwx ww w pwwwwgawvwwwqqDwwwwwwqwwvwfwwfwwvawwvawwfawwvffA""DIII$IIA"!ID!B!D"D")) D!DD DID!Dffffwgwfwwfwwwqq{w{ww03;~ 337ww{7;;330wws0s3333wwwss3331s1wwfffwvfafffffa'"''"g'v"ffb"&$""III ""  " "")wy''rw''rw" "" "B$""")wy''rw''rw""") "";333 q;33{1331337{;33307wws7;;33wwqwqwwqwwqww$""$Bgw"&""&bw"""r"""""""$D") ) $ ''rw)wy)""$""" """"""'"By"" "" ''rw)wy)""$)""" ""'""y"B""" ""{{{{񻻱񻻱񻻱񻻱""ww'"*"**'"'"'"w"w "r" w w*rw*r"w'w'z'z"""""""w r" w*rw*rw*r"w*"w w w "w'*"**"w"w"w"w wrw w *wr*wr*wr|g{{˻˻̻w̻wyi̪wa|̑aw{"((("((" "!;" "$D$"D)")"D" " ID $I DB$IBffffffbwwffmfmfm-w"a "'"'*z"*w"w""""w*rw*r" w w"" """"""""""*"*""""w*rw*rwzr "" "***"*""" * " ""w"w"w*z*z"""*wr*wr*wrw w """ "|wl̻fafaf{ff6f6aa"((""((""""(((!""!))))"""DBIB$B" gwgwIDIawwfffffw"wfwwfwwfqwfvfffaffwwqwwwwwwqyyww {zgs s1zg06zg6z`61"""(/"""" "(" (""/" "" ww}|}w|||qqwwp|p|w}|}w w ||p wffwwgqwwwwwwwwqwwwwD@fIIvDwiBwv wwBawwfawwfawwqwwwwyywqw)"))) " wz ww wwww))""")""""""""" ww""" "" "))""")""") """" ww""" """))""")""""""""" ww""" ) "|w|ppw| p wwwwqwgwwfwwfffffffwwfawwfawvfawfffffffaff ---.---.     ׍-  -  - - -----.----... ֝-..׍ם-.ƍ -. -. -..G.n׍~& ,. -. ,n~~  ~    n~ᶶ , n~~~    ---n-~~~~~n~~~n~~~~~~~n~~~   ~~ ----,-. ׍ n~~~,-O~~~~OO      ,  -  -__  , _-O  -, -- -- O ,, -- -- ----OO - -,-n~~~    ,---_OOOO. - -OO -  O O --OOOO--     -_       www;;;331333wwww;;;;3313333wwwq;;;1331333IDIDIwwwwADAAAIADAA""""""""""""""""""" """ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww`PpPPPP``333333333333333333333333333333333333333333333;;333;;333;;333;;33DIDIAIADAAAIADAA"""""""" """ """""""""""""""""""""""""""""""""""""""""""""  """""""""""""""" "" """"""""""" """wwwwwwwwpwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwAaqabffffAaAQbBRffffP`AQAQPBrBrRRAQ``PBRp333331;;;3333333331;;;;3333333331;;;11333DIDDDIDDDDAIADAAAIADDDAwww("wwww"("wwwq!"(DIDDIDDIDDID03333033333333333;33333FVFV"I$$""FVFV" "IB B ""DB""DB""$ PPp`P`PP`313331yy133313AoffaoffffaaAfaDf$$B""$D)"$D/IBB""$$)$B"/$BBDmmmmADD71wsw{")")I$$II"B"""$IDDDB""BD""$"""$""""""" D"DDD"D"IDBD$"""B"""$"""" B D ID"IB33;3;3;.-fffmQffmP`Pp``P;@@`aN@@N@@notpq~@@@@b@`a@@`apq@@pqN0noNnono~~~no`aH~pq@@@nonono~~~ @ @ b@@@@@ @ J t@@@ @@ L@@   0 J @@J @ m}}lmll}mm}lmm}m}}}}}mml}mmlt}}}lmm}l}}}}m}}}}ml}}l`a@@}lml}mm}@@pq}@@`amm}}}ll}b`a`apq}}@@lm}@@`a`a@@pqpqkkkk}`apqpq`apqkkpqkk`akk0pqkkkkk}`akkkkpqkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk""""""""""""wwwwwwwwwwwwwwwwwwwwwwAwwwwI""""""""""""wwwwwwwwwwwwqADD""""""""""""wwwwwwwwwwwwAI""""""""""""wwwwwwwwwwwwA""" """""""wwwwwwwpwww133133133AI""" """""""wwwwwwwpwww333333ADD""""""""""wwwwwwwwww3333AI""""""""wwwwwwww;;333333A"""""" "wwww33333333AI""""""""""wwwwww;;333333ADD""" """""" ""wwwpwww33333333AI""" """""""" wwwpwww;;333333A"""""""" """"""wwwwwwww33333333AI"""""""""" """wwwwwwww&&$%$'$'$%;;333333ADD"""""""" """wwwwwwwwffffffff33333333AI"""""""""""wwwwwwww(%(%3333ADIdededede333333AIwwwwwwwwwwD0"""133133133ADDqDI33 $;AID033BI$1;;;;;;;;;;ADI3333BII"3333333333AI!D33331 ""D$ADDDDDDDDDD(""(""(DI3333"""D$D33313 ""B313ABIB $"""""33;3 33ff$""B "BID"I;3f1oaD"Bm1"DDDDDD$mf]yfafD$mA "I$"""D"D)yfaf$""BDDs )I$D""D$DBImff1aABIBm{BIB""""""$IfQ33f$"Bm1w7B)B"""""BD)"313Daf$)$Dw"I""""""III$ {@ ` ::`88@666 4`4422 2@0@02 4 6`<>@   4`4`<`<`4 4 < < < < > > ppppppp pp@p p p`pp`pp`pp@4>>>>>>>>>>>>>>>>>>>P4>4>4>4 > 4`>`4`>`````` ```` ``@`````@`` ``l`db`` ```df f@hhjjlllnnnnd ff`hj@jn@446644444644444 4 4`6`8`4684`4`668844@```````@ljjljjljjljjljjljjljjjj@446644444444444 4 446688::446688@4 4 4 4 4444446644664@4@6@6@4466446644@J J H H F D D`DDDDDDDD`D`JJHHFFDDDDFFHH@JJHHFDD D`DDDD`D`D`D D JJHHFFDDDDFFHH@    ```````````@    ````@L@J@H@H@F@D@DDDDDDD@D@F@F@LJHHFDD D`DDDDDD@LJHHFDDDDDDDDDDDD@D@D@D@D@D@D@D@DDDDDD@LJHFFDDDFFFFFFFFHHHHJJJJLLLLLL@    ````````@````````@`ddddndnnd`ddddndnnd``ddddndnnddddnddddd`D@D@D@D@D@D@D D DDDDDDDDD@D@D@D@D@D@D D DDDDDD`D@D@D@D@D@D@D D D`D`D`D D D D`D`DDDD`D`D`DDD D D D D D `D@D@D@D@D@D@D D DDDDDDDDD@D@D@D@D@D@D D D`D`D`D`D`D``D@D@D@D@D@D@D`D`D D D DDDD`D`DDDD D D DDDDDDDD`4@4444@4@4@4@4@4@4@4@4@4@4@4@4@4444444444444`444444444444444444444@4@4@4@4@4@4@4@4@4@`D@DDDD@D@D@D@D@D@D@D@D@D@D@D@DDDDD D D D D D D D D D `DD D D`DDDDDDDDDDDDDD`D`DDDDDDDDDDD``@``@` `@@` `@` `` @``` `` @44444 4 444444444 4 4@4@4 4 4 4 44444444@444444444444444444444 4 44444444@4 4 4444444 4 4@4@4 4 4444444444444444@    ````    @  @@@@@@@@@    ``              @ddndndnddddddddddddndn@ddddddddddddndnddddd@dddddddndndddddddddd@    ```` @ @@         `@``` @  @  @  @@h@> > > n@> > > h@> > > n@>>>`h@>> >`n@> h@n@@@@@@@>>>>>>>>>@@@>>>@>@>>4`4 44 444>>>>>>>>@>@>@>@>@>@>@>@>>D >>>>>>>D D`DDDD`DDDD D`NNN>>>>>>468:464@4@4848468:<>>>>>>>>>>>>48<448468:44468468468:<<44@468:    ``              DND`NDNDND`NDNDND`NDNDND`NDNDND`NDN`` dddddddddddddddddddd DDDD`D DDDD ND DDDD`D DD D`ND`D DDDD`D D`DD !=1333333swwwww717s;33373333133333313333133331333313333{www7swwwww7swwww7swwww7swwww7swwww77171{1{1{1{;s;s7s7s7s7;;;;;333333;;;;11qssq{{{{1111;;133133133331331331333311333333sww7qsww7qs{s{11;;1333313333wwwwwwwwqwwwwwqwwwwwwwqwwwwwwwwwqwww|wwwwwwwqwww|wwwwwwwwqwwwwwwwwwwwwwqwwwwwwwwwwwwwwqqwwwwwwwwwwwwwwqwqwwwwwwwwwwwwwwwqwwwwwwwwwwwwwwwwwwwwwwwwwwqwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww|wwq1qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww|www1qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3wqwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww11wqwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww133qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww113qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww13qw;qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww13qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3wqwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww13wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww3qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww13qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww33wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww33wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww133;qwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww133qwwwwwwwwwwwwwwwwwwwwwwww33wwwwwwwwww3|w13wwwww13qw1;3313qwwww33313331111;31;11;1;3;3;3;1;1331;3333;|133ww33133|||1331;3;|w|w331;3|w|w33333|w3A333;|1A1333;3|13D1333333|ww333A3333w|ww3313|w;333w|1;33333w||;333w;3!|3w||;3|w13!|ww1;BDD|www;BD$w||3!D$w!DID|||!DDIDD|ww!BDDDDDDDDD|||"DDDDDDDDDDD$||BDDDDDDD"BDDDDD"|ww!DDDD"q|BDD""||D$""|"""w!""!|||||||w|w|!!wwwѸ-- title: Pico Froggo: Hop Across the Seasons TIC-80 version -- author: nazartopsuper -- desc: Powered p82tic __sfx=sfx function sfx(n,channel,offset) if n==-2 then __sfx(-1) else if n==-1 then __sfx(-1,nil,nil,channel) else __sfx(n,28,-1,channel) end end function stat(i) if i==0 then return collectgarbage("count") end return 0.5 end function sub(str,i,j) return str:sub(i,j) end add=table.insert function all(list) local i = 0 return function() i = i + 1; return list[i] end end count=table.getn function del(t,a) for i,v in ipairs(t) do if v==a then t[i]=t[#t] t[#t]=nil return end end end function foreach(t, f) for v in all(t) do f(v) end end if mt ~= nil then mt = {} end function sgn(a) if a>=0 then return 1 end return -1 end function cos(a) return math.cos(2*math.pi*a) end function sin(a) return -math.sin(2*math.pi*a) end function atan2(a,b) b=b or 1 return math.atan(a,b)/(2*math.pi) end function mid(a,b,c) if a<=b and a<=c then return max(a,min(b,c)) elseif b<=a and b<=c then return max(b,min(a,c)) end return max(c,min(a,b)) end function band(a,b) return math.floor(a)&math.floor(b) end function bor(a,b) return math.floor(a)|math.floor(b) end function bxor(a,b) return math.floor(a)^math.floor(b) end function bnot(a,b) return math.floor(a)~math.floor(b) end __p8_color=7 __p8_ctrans={true,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false} __p8_camera_x=0 __p8_camera_y=0 __p8_cursor_x=0 __p8_cursor_y=0 __p8_sflags={} for i=1,256 do __p8_sflags[i]=0 end function camera(cx,cy) cx=cx or 0 cy=cy or 0 __p8_camera_x=-math.floor(cx) __p8_camera_y=-math.floor(cy) end function cursor(cx,cy) cx=cx or 0 cy=cy or 0 __p8_cursor_x=math.floor(cx) __p8_cursor_y=math.floor(cy) end function __p8_coord(x,y) return math.floor(x+__p8_camera_x), math.floor(y+__p8_camera_y) end __print=print function print(str,x,y,c) x=x or __p8_cursor_x y=y or __p8_cursor_y c=c or __p8_color c=peek4(0x7FE0+c) __print(str,x,y,c) __p8_cursor_y=y+8 end function color(c) c=c or 7 __p8_color=math.floor(c%16) end function pal(c0,c1,type) c0=c0 or -1 c1=c1 or -1 type=type or 0 if c0<0 and c1<0 then if type==0 then for i=0,15 do poke4(0x7FE0+i,i) end end else c0=math.floor(c0%16) if c1<0 then c1=c0 end c1=math.floor(c1%16) if type==0 then poke4(0x7FE0+c0,c1) else local stri for i=0,5 do stri=#__p8_pal-(c1+1)*6+i poke4(0x3FC0*2+#__p8_pal-(c0+1)*6+i,tonumber(__p8_pal:sub(stri,stri),16)) end end end end function palt(c,trans) c=c or -1 if c<0 then -- reset __p8_ctrans[1]=true for i=2,16 do __p8_ctrans[i]=false end else __p8_ctrans[math.floor(c%16)+1]=trans end end function pset(x,y,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) poke4(y*240+x,c) end function pget(x,y) x,y=__p8_coord(x,y) return peek4(y*240+x) end __rect=rect function rectfill(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) local w,h=x1-x0,y1-y0 __rect(x0,y0,w+sgn(w),h+sgn(h),c) end function rect(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) local w,h=x1-x0,y1-y0 rectb(x0,y0,w+sgn(w),h+sgn(h),c) end __circ=circ function circfill(x,y,r,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) __circ(x,y,r,c) end function circ(x,y,r,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) circb(x,y,r,c) end __line=line function line(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) __line(x0,y0,x1,y1,c) end function sspr(sx,sy,sw,sh,dx,dy,dw,dh) -- todo dw=dw or sw dh=dh or sh dx,dy=__p8_coord(dx,dy) if dx>240 or dy>136 then return end local xscale,yscale=dw/sw,dh/sh local startx,starty,c=0,0 if dx<0 then startx=-dx end if dy<0 then starty=-dy end if dx+dw>240 then dw=240-dx end if dy+dh>136 then dh=136-dy end for x=startx,dw-1 do for y=starty,dh-1 do c=sget(sx+x/xscale,sy+y/yscale) c=peek4(0x7FE0+c) if not __p8_ctrans[c+1] then poke4((dy+y)*240+dx+x,c) end end end end __spr=spr function spr(n,x,y,w,h) --todo flip_x,y w=w or 1 h=h or 1 local sx,sy,xoff,yoff=n%16*8,math.floor(n/16)*8,0,0 for j=0,h-1 do for i=0,w-1 do sspr(sx+xoff,sy+yoff,8,8,x+xoff,y+yoff) xoff=xoff+8 end yoff=yoff+8 xoff=0 end end __map=map function map(cel_x,cel_y,sx,sy,cel_w,cel_h) sx,sy=__p8_coord(sx,sy) local cel for cy=0,cel_h-1 do for cx=0,cel_w-1 do cel=mget(cx+cel_x,cy+cel_y) spr(cel,sx+cx*8,sy+cy*8) end end end function sset(x,y,c) x,y=math.floor(x),math.floor(y) local addr=0x8000+64*(math.floor(x/8)+math.floor(y/8)*16) poke4(addr+(y%8)*8+x%8,c) end function sget(x,y) x,y=math.floor(x),math.floor(y) local addr=0x8000+64*(math.floor(x/8)+math.floor(y/8)*16) return peek4(addr+(y%8)*8+x%8) end function flip() end function fset(n,f,v) if f>7 then __p8_sflags[n+1]=f else local flags=__p8_sflags[n+1] if v then flags=flags|(1<0 then return true end return false end pico8ButtonMap = {} pico8ButtonMap[1] = 2 -- 0 left pico8ButtonMap[2] = 3 -- 1 right pico8ButtonMap[3] = 0 -- 2 up pico8ButtonMap[4] = 1 -- 3 down pico8ButtonMap[5] = 4 -- 4 o pico8ButtonMap[6] = 5 -- 5 x pico8ButtonMap[7] = 6 -- 6 start pico8ButtonMap[8] = 7 -- 7 Doesn't exist function pico8ButtonToTic80(i, p) if p == nil then p = 0 end return p * 8 + pico8ButtonMap[i + 1] end __btn = btn function btn(i, p) return __btn(pico8ButtonToTic80(i, p)) end __btnp = btnp function btnp(i, p) return __btnp(pico8ButtonToTic80(i, p)) end __updateTick = true __initalized = false function TIC() -- Initialize if __initalized == false then if _init ~= nil then _init() end __initalized = true end if _update60 ~= nil then -- 60 FPS _update60() if _draw ~= nil then _draw() end elseif _update ~= nil then -- 30 FPS if __updateTick then _update() if _draw ~= nil then _draw() end end __updateTick = not __updateTick end end -- Add pico-8 cart below! -- pico froggo -- hop across the seasons function _init() mode = "title" cam_x, cam_y = 0, 0 --template object d_obj = {x=64, y=0, w=16, h=16, osx=0, osy=1, --offset x / y f_w=2, f_h=2, --frame w / h x_v=0, y_v=0, frame=1, grounded=0, name="", } timer = 0 jump_pressed, x_pressed = false, false ani_frames = {52, 54, 52, 56, 60, 62} bell_frames = {118, 120, 118, 122} spin_frames = {{true, false}, {false, false}, {false, true}, {true, true}} cavern_pal = {[2]=3, [3]=4, [11]=4, [15]=9, [7]=15} summer_pal = {[2]=3, [3]=4, [11]=9} autmun_pal = {[3]=4, [11]=9, [0]=128} winter_pal = {[3]=13, [11]=6} lvl = 0 data = {{season=0, level=0, msc=0, clr=12, bg=5, filter={8,78,110,111,126,127,15}}, {season=0, level=2, msc=10, clr=0, bg=0, filter={108,109,125,230,231,232,233,107,28,14,15, 30}}, {season=1, level=1, msc=0, clr=1, bg=0, filter={76,11}}, {season=1, level=0, msc=0, clr=12, bg=3, filter={246,247,248,249,96,97,112,113,72,78,110,111,126,127,15,201,202,203,218,219}}, {season=2, level=1, msc=20, clr=15, bg=1, filter={74,244,30}}, {season=2, level=2, msc=10, clr=0, bg=4, filter={96,97,112,113,108,109,125,107,15,245,216,217}}, {season=3, level=0, msc=20, clr=0, bg=2, filter={8,246,247,248,249,96,97,112,113,72,201,202,203,218,219}}, {season=3, level=2, msc=10, clr=0, bg=7, filter={26,96,97,112,113,230,231,232,233,14, 30,245,216,217}}, } title_bg = {6,2,3,5} title_init() txts = {"start of spring", "frisky flowery field", " end of spring ", "venture in the cavern", "start of summer", "tongue through the woods", " end of summer ", "ribbit in the beach", "start of autumn", "fallen golden leaves", " end of autumn ", "hop across the mushrooms", "start of winter", "snowball fight", " end of winter ", "dodge the deadly icicles", } grad_1 = {7, 6, 6, 12} grad_2 = {1, 5, 13, 12} end_txts = {"it's the end of the journey,", "the end of the year", "through spring and summer,", "across autumn and winter", "froggo had much fun going", "on this seasonal adventure", } hats = {{56, 48, 8}, {72, 48, 8}, {96, 113, 7}, {96, 120, 8}, } hat = 0 cheat = 0 pp_init() tr_timer, init = 32, true end --flags --solid, semisolid, hurt, grapple, _, _, _, object function _update() --misc timer = (timer + 1)%3200 --loop if mode == "title" then loop_title() elseif mode == "level" then loop_level() elseif mode == "end" then loop_end() end --variables jump_pressed = btn(🅾) x_pressed = btn(❎) up_pressed = btn(⬆) down_pressed = btn(⬇) left_pressed = btn(⬅) right_pressed = btn(➡) end function _draw() if mode=="title" then draw_title() elseif mode == "level" then draw_level() elseif mode == "end" then draw_end() end if cheat == 12 then pal(11, 6, 1) pal(3, 5, 1) end end function loop_title() cam_x = (cam_x+1)%128 camera(cam_x, 0) if not init and tr_timer < 32 then tr_timer =tr_timer+ 1 if tr_timer >= 32 then init = true end end if init then if btn(🅾) and tr_timer == 32 then tr_timer =tr_timer- 1 music(-1) sfx(5) end if tr_timer < 32 then tr_timer =tr_timer- 1 end if tr_timer <= -8 then mode = "level" load_level(0) cam_x = 0 tr_timer = -8 camera(0, 0) end end --password if btn(❎) then if not x_pressed then password = "" end if #password < 8 then if btn(⬆) and not up_pressed then password = password.."⬆" end if btn(⬇) and not down_pressed then password = password.."⬇" end if btn(⬅) and not left_pressed then password = password.."⬅" end if btn(➡) and not right_pressed then password = password.."➡" end cheat = 0 if #password == 8 and cheat_list[password] ~= nil then cheat = cheat_list[password][1] sfx(2) end end end particles_update() end function loop_level() if player.alive and not goal and tr_timer < 32 then tr_timer =tr_timer+ 2 tr_x, tr_y = player.x+8-cam_x, player.y+4-cam_y end --player script player_movement(player) if player.alive then move_obj(player) end if cheat ~= 11 then if player.x < 0 then player.x = 0 end if player.x > 1008 then player.x = 1008 end if player.y < level*128 then player.y = level*128 end end if player.y > level*128+128 then if cheat == 9 and player.alive then player.y =player.y- 132 elseif cheat == 10 and player.alive then player.y, player.grounded = level*128+128, 4 elseif cheat == 11 and player.alive then if player.y > 512 then player.y = 0 end else tr_timer =tr_timer- 2 tr_y = 128 tr_x = 64 if tr_timer > 0 and player.alive then sfx(6,3) player.alive = false end if tr_timer <= -16 then reload() load_level(lvl) tr_y = 64 end end end if goal then tr_timer =tr_timer- 2 tr_x = player.x + 8 - cam_x tr_y = player.y + 4 - cam_y if tr_timer <= -16 then reload() cp, goal, init = false, false, true if lvl+1 == 8 then mode = "end" particles_init(0) particles_init(10) tr_x, tr_y, tr_timer = 64, 64, -16 end_timer = 0 for i=1, 3 do add(ptcs, {x=64, y=32*i-12, x_v=0, y_v=0, shape=13, grad=0, txt_1=end_txts[i*2-1], txt_2=end_txts[i*2], timer=72*i+32}) end math.randomseed(stat(95)) add(ptcs, {x=32, y=114, x_v=0, y_v=0, shape=13, grad=0, txt_1="❎ - "..hint_list[ceil(math.random()*(#hint_list))], txt_2="", timer=300}) music(53) else load_level((lvl+1)%8) end tr_y = 64 end end --camera cam_x = player.x-64+player.w/2 if cheat == 11 then cam_y = player.y-64+player.h/2 else if cam_x < 0 then cam_x = 0 end if cam_x > 896 then cam_x = 896 end end camera(cam_x, cam_y) --object update if tr_timer >= -16 then for obj in all(room) do if obj.hurt then enemy(obj) end if obj.t_hurt then t_enemy(obj) end if obj.physics then physics(obj) move_obj(obj) end if obj.name == "jim" then jim_update(obj) end if obj.name == "ant" then ant_update(obj) end if obj.name == "ball" then ball_update(obj) end if obj.name == "h_ball" then h_ball_update(obj) end if obj.name == "coin" then coin_update(obj) end if obj.name == "leaf" then leaf_update(obj) end if obj.name == "seagull" then seagull_update(obj) end if obj.name == "icicle" then icicle_update(obj) end if obj.name == "checkpoint" then checkpoint_update(obj) end if obj.name == "goal" then goal_update(obj) end if obj.name == "hat" then hat_update(obj) end if obj.y > 512 then del(room, obj) end end end particles_update() end function loop_end() cam_x, cam_y = 0, 0 camera(cam_x, cam_y) if end_timer < 300 then end_timer =end_timer+ 1 if tr_timer < 32 then tr_timer =tr_timer+ 1 end else if ((btn(🅾) or btn(❎)) and tr_timer == 32) or tr_timer < 32 then tr_timer =tr_timer- 1 end if tr_timer == -8 then mode = "title" title_init() end end particles_update() end function draw_title() if t_bg == 2 then cls(0) else cls(12) end draw_bg(t_bg) particles_draw() map(112, 48, cam_x, 0, 16, 8) for i=-1, 1 do for j =-1, 1 do print("hop across the seasons", cam_x+20+i, 66+j, 1) end end print("hop across the seasons", cam_x+20, 66, 11) if cheat ~= 0 then st = cheat_list[password][2] for i=-1, 1 do for j=-1, 1 do print(st, cam_x+64+i-#st*2, 80+j, 0) end end print(st, cam_x+64-#st*2, 80, 10) end if btn(❎) then print("❎ - ", cam_x+21, 97, 0) print("❎ - ", cam_x+22, 96, 7) print(password, cam_x+41, 97, 0) print(password, cam_x+42, 96, 7) elseif tr_timer ~= 32 and init then print("press 🅾 to start!", cam_x+29, 97, 0) print("press 🅾 to start!", cam_x+30, 96, 7+3*math.floor(timer/2%2)) elseif timer % 32 < 16 then print("press 🅾 to start!", cam_x+29, 97, 0) print("press 🅾 to start!", cam_x+30, 96, 7) end --particles particles_draw() end function draw_level() cls(clr) palette() draw_bg(bg) if cheat == 11 then map(0, 0, 0, 0, 128, 128) else map(0, level*16, 0, level*128, 128, 16) end pal() --dark background for this specific level lmao if season == 2 and level == 2 then poke(0x5f10,128) end --draw objects for obj in all(room) do if obj.rotate then spr(obj.frame, obj.x+obj.osx, obj.y+obj.osy, obj.f_w, obj.f_h, spin_frames[math.floor(obj.x%32/8)+1][1], spin_frames[math.floor(obj.x%32/8)+1][2]) elseif obj.name == "jim" then spr(obj.frame, obj.x+obj.osx, obj.y+obj.osy, 1, 2) spr(obj.frame, obj.x+obj.osx+8, obj.y+obj.osy, 1, 2, true) spr(obj.frame2, obj.x+obj.osx, obj.y+obj.osy+13, 1, 1) spr(obj.frame2, obj.x+obj.osx+8, obj.y+obj.osy+13, 1, 1, true) elseif obj.name == "ant" then if obj.hat > 0 then sspr(hats[obj.hat][1],hats[obj.hat][2],16,hats[obj.hat][3],obj.x+obj.osx,obj.y+obj.osy+6-hats[obj.hat][3],16,hats[obj.hat][3],obj.face_r, false) end spr(obj.frame, obj.x+obj.osx, obj.y+obj.osy, 2, 1, obj.face_r) spr(obj.frame2, obj.x+obj.osx, obj.y+obj.osy+8, 2, 1, obj.face_r) elseif obj.name == "ball" then spr(obj.frame, obj.x, obj.y, 1, 1) spr(obj.frame, obj.x+8, obj.y, 1, 1, true) elseif obj.four then spr(obj.frame, obj.x, obj.y, 1, 1) spr(obj.frame, obj.x+8, obj.y, 1, 1, true) spr(obj.frame, obj.x, obj.y+8, 1, 1, false, true) spr(obj.frame, obj.x+8, obj.y+8, 1, 1, true, true) elseif obj.name == "seagull" then spr(obj.frame, obj.x, obj.y, 2, 2) spr(obj.frame+2, obj.x-8, obj.y, 1, 1, true) spr(obj.frame+2, obj.x+16, obj.y, 1, 1) elseif obj.name == "goal" then spr(116, obj.x, obj.y, 2, 1) spr(obj.frame, obj.x, obj.y+8, 2, 1) elseif obj.name == "hat" then sspr(hats[obj.type][1],hats[obj.type][2],16,hats[obj.type][3],obj.x,obj.y) else spr(obj.frame, obj.x+obj.osx, obj.y+obj.osy, obj.f_w, obj.f_h, obj.face_r) end end --draw player if player.alive then if hat > 0 then sspr(hats[hat][1],hats[hat][2],16,hats[hat][3],player.x+player.osx,player.y+player.osy-1-hats[hat][3],16,hats[hat][3],player.face_r, false) end if player.t_timer > 0 then rectfill(player.x+8, player.y+1, player.t_x, player.y+3, 1) end if player.inv <= 0 or timer%2==1 then spr(player.frame_2, player.x, player.y-7+player.osy, 2, 1, player.face_r, false) spr(player.frame, player.x, player.y+1+player.osy, 2, 1, player.face_r, false) end --tongue if player.t_timer > 0 then rectfill(player.x+8, player.y+2, player.t_x, player.y+2, 8) spr(1, player.t_x-4, player.y) if player.t then spr(player.t.frame, player.t_x-8+player.t.osx, player.y-6+player.t.osy, player.t.f_w, player.t.f_h) end end else spr(16, player.x, player.y-7, 2, 2, false, true) end --ui if hp==2 then spr(18, cam_x+4, cam_y+4, 1, 2, false) spr(18, cam_x+12, cam_y+4, 1, 2, true) elseif hp==1 then spr(18, cam_x+4, cam_y+4, 1, 2, false) spr(19, cam_x+12, cam_y+4, 1, 2, true) else spr(19, cam_x+4, cam_y+4, 1, 2, false) spr(19, cam_x+12, cam_y+4, 1, 2, true) end --particles particles_draw() end function draw_end() cls(12) draw_bg(3) if end_timer >= 300 and timer % 32 < 16 then spr(41, 112, 112) end particles_draw() end function draw_bg(n) if n == 2 then pal(11,6,0) pal(3,13,0) map(56, 48+4*math.floor(timer%40*0.05), cam_x, cam_y+8, 8, 4) map(56, 48+4*math.floor(timer%40*0.05), cam_x+64, cam_y+8, 8, 4) for i=0, 3 do map(48, 53, cam_x+64*i-cam_x/2%64, cam_y+56, 8, 4) end rectfill(cam_x, cam_y+88,cam_x+128,cam_y+128,13) map(56, 56+4*math.floor(timer%40*0.05), cam_x, cam_y+88, 8, 4) map(56, 56+4*math.floor(timer%40*0.05), cam_x+64, cam_y+88, 8, 4) pal() palette() rectfill(cam_x, cam_y+80,cam_x+128,cam_y+80,6) rectfill(cam_x, cam_y+94,cam_x+128,cam_y+96,6) rectfill(cam_x, cam_y+102,cam_x+128,cam_y+102,6) rectfill(cam_x, cam_y+89,cam_x+128,cam_y+89,6) rectfill(cam_x, cam_y+112,cam_x+128,cam_y+112,6) elseif n == 3 then circfill(cam_x+16,cam_y+60,24+sin(timer/64)*2,7) circfill(cam_x+100,cam_y+64,28+sin(timer/60)*1.5,7) circfill(cam_x+48,cam_y+68,20+cos(timer/72)*2,7) rectfill(cam_x,cam_y+64,cam_x+128,cam_y+128,12) for i=0,16 do len = math.abs(sin(timer/128+i*0.19625)*(24-i)*2) line(cam_x+64-len,cam_y+i+64,cam_x+64+len,cam_y+i+64,7) end elseif n == 4 then pal(1, 2) elseif n == 5 then for i=0, 3 do map(48, 48, cam_x+64*i-cam_x/2%64, cam_y+16, 8, 5) end for i=0, 3 do map(48, 53, cam_x+64*i-cam_x/2%64, cam_y+64, 8, 2) end for i=0,8 do len = math.abs(sin(timer/128+i*0.19625)*(24-i)*2) line(cam_x+64-len,cam_y+i+80,cam_x+64+len,cam_y+i+80,7) end elseif n == 6 then pal(11,9,0) pal(3,4,0) pal(1,2,0) for i=0, 3 do map(48, 48, cam_x+64*i-cam_x/2%64, cam_y+16, 8, 5) end for i=0, 3 do map(48, 53, cam_x+64*i-cam_x/2%64, cam_y+64, 8, 2) end pal() for i=0,8 do len = math.abs(sin(timer/128+i*0.19625)*(24-i)*2) line(cam_x+64-len,cam_y+i+80,cam_x+64+len,cam_y+i+80,7) end elseif n == 7 then for i=0, 2 do map(56, 48+4*math.floor(timer%40*0.05), cam_x+64*i-cam_x/2%64, cam_y+24, 8, 4) end for i=0, 2 do map(56, 56+4*math.floor(timer%40*0.05), cam_x+64*i-cam_x/2%64, cam_y+72, 8, 4) end end end function title_init() math.randomseed(stat(95)) t_bg = title_bg[math.floor(math.random()*(4))+1] particles_init(t_bg) particles_init(10) music(55) tr_x, tr_y, tr_timer = 64, 64, -16 goal, cp, init = false, false, false end -->8 --functions --collision function move_obj(obj) local t1, t2, dx, dy if obj.grounded > 0 then obj.grounded =obj.grounded- 1 end --horizontal collision if obj.x_v >= 0 then dx=(obj.x+obj.w+obj.x_v)/8 elseif obj.x_v < 0 then dx=(obj.x+obj.x_v)/8 end dy=(obj.y)/8 --semi solid (ghost mode) if cheat == 6 and obj.name=="player" then t1 = mget(dx, dy) if fget(t1, 0) and obj.y_v >= 2 then if obj.name == "player" and obj.y_v > 0 and obj.grounded == 0 then sfx(8, 3) end obj.grounded, obj.y_v = 4, 0 end --regular elseif (dy >= level*16 and dy <= level*16+16) or cheat == 11 then t1, t2 = mget(dx, dy), mget(dx, dy+obj.h/8) if (fget(t1, 0) or fget(t2, 0)) and obj.x_v ~= 0 then if obj.x_v > 0 then obj.x = dx*8-obj.w-obj.x_v obj.hit_r = true elseif obj.x_v < 0 then obj.x = dx*8-obj.x_v obj.hit_l = true end obj.x_v = 0 end if obj.name=="player" and obj.inv <= 0 and (fget(t1, 2) or fget(t2, 2)) then hurt_player() end end --vertical collision dx=(obj.x)/8 if obj.y_v >= 0 then dy=(obj.y+obj.h+obj.y_v)/8 elseif obj.y_v < 0 then dy=(obj.y+obj.y_v)/8 end if (dy >= level*16 and dy <= level*16+16) or cheat == 11 then t1, t2 = mget(dx, dy), mget(dx+obj.w/8, dy) if (fget(t1, 0) or fget(t2, 0)) and obj.y_v ~= 0 and dy <= level*16+16 and dy >= level*16 then if obj.y_v > 0 then obj.y = math.floor(dy)*8-obj.h if obj.name == "player" and obj.y_v > 2 and obj.grounded == 0 then sfx(8, 3) end obj.grounded = 4 obj.y_v = -0.5 if fget(t1, 5) or fget(t2, 5) then obj.ice = 4 end elseif obj.y_v < 0 then obj.y = dy*8-obj.y_v obj.y_v = 0 else obj.y_v = 0 end --semi solid elseif (fget(t1, 1) or fget(t2, 1)) and obj.y_v >= 0 then if obj.name == "player" and obj.y_v > 2 and obj.grounded == 0 then sfx(8, 3) end obj.y, obj.grounded, obj.y_v = math.floor(dy)*8-obj.h, 4, -0.5 end if obj.name=="player" and obj.inv <= 0 and (fget(t1, 2) or fget(t2, 2)) then hurt_player() end end --platform objects for plt in all(room) do if plt.platform and obj.y_v >= 0 and obj.y+obj.h-obj.y_v <= plt.y+4 and collide(obj, plt) then obj.y, obj.grounded, obj.y_v = plt.y+plt.y_v-obj.h, 4, 0 obj.x =obj.x+ plt.x_v end end --ant edge detection if obj.name == "ant" then if fget(t1, 0) or fget(t1, 1) then obj.feet.l = true end if fget(t2, 0) or fget(t2, 1) then obj.feet.r = true end end obj.x =obj.x+ obj.x_v obj.y =obj.y+ obj.y_v end --entity collision function collide(a, b) return a.x <= b.x+b.w and a.y <= b.y + b.h and b.x <= a.x+a.w and b.y <= a.y + a.h end function t_collide(a) return a.y <= player.y + player.h and player.y <= a.y + a.h and math.abs(player.t_x - a.x - a.w/2) < 8 and player.t_timer > 0 end --enemy hit function hurt_player() player.inv = 60 hp =hp- 1 if hp <= 0 or cheat == 1 then player.alive = false player.y_v = -6 end sfx(6,3) end function enemy(a) if player.inv <= 0 and a.x <= player.x+player.w and a.y <= player.y + player.h and player.x <= a.x+a.w and player.y <= a.y + a.h then hurt_player() end end function t_enemy(a) if not player.t and player.inv <= 0 and a.y <= player.y + player.h and player.y <= a.y + a.h and math.abs(player.t_x - a.x - a.w/2) < 8 and player.t_timer > 0 then hurt_player() end end --object creation function create_obj(id, x, y) local obj = {} for key, value in pairs(d_obj) do obj[key] = value end obj.x, obj.y, obj.frame = x*8, y*8, id --player if id == 48 then obj.y =obj.y- 1 obj.name, obj.w, obj.h, obj.face_r, obj.frame, obj.frame_2, obj.t_pos, obj.t_x, obj.t_timer, obj.s_timer, obj.t, obj.climb, obj.inv, obj.alive, obj.climb_cooldown, obj.ice = "player", 14, 8, true, 52, 48, 0, 0, 0, 0, nil, false, 0, true, 0, 0 --coin elseif id == 64 then obj.name, obj.osy = "coin", 0 --jim elseif id == 26 then obj.y =obj.y+ 7 obj.x =obj.x+ 4 obj.w, obj.h, obj.timer, obj.osx, obj.osy, obj.name, obj.physics, obj.hurt, obj.t_hurt = 8, 8, 0, -4, -7, "jim", true, true, true --ant elseif id == 28 or id == 30 then obj.y =obj.y+ 7 obj.x =obj.x+ 4 obj.feet = {l=false, r=false} if ceil(math.random()*(8)) == 4 then obj.hat = season+1 elseif cheat == 13 then obj.hat = ceil(math.random()*(4)) else obj.hat = 0 end obj.w, obj.h, obj.timer, obj.osx, obj.osy, obj.step, obj.name, obj.physics, obj.hurt, obj.edible, obj.face_r = 8, 8, 0, -4, -7, 0, "ant", true, true, true, false --ball elseif id == 14 or id == 15 then obj.name = "ball" --leaf elseif id == 11 then obj.init, obj.name, obj.osx, obj.osy, obj.w, obj.h, obj.platform, obj.f_w, obj.f_h = false, "leaf", 4, -4, 32, 8, true, 3, 1 --seagull elseif id == 8 then obj.name, obj.o_x, obj.y, obj.w, obj.h, obj.platform, obj.y_v = "seagull", obj.x, level*128-16, 32, 8, true, 4 --icicles elseif id == 108 then obj.name, obj.f_w, obj.f_h, obj.hurt = "icicle", 1, 2, true --checkpoint elseif id == 98 then obj.name, obj.frame, obj.spawn = "checkpoint", -2, true --goal elseif id == 116 then obj.name, obj.timer, obj.rung, obj.m = "goal", 150, false, false --hat elseif id <= 106 and id >= 103 then obj.name, obj.type, obj.physics, obj.h, obj.physics = "hat", id-102, true, 8, true end --movable platform objects if 70 < id and id < 80 then obj.x =obj.x+ 3 obj.frame = 72 + season * 2 obj.name, obj.platform, obj.edible, obj.s, obj.rotate, obj.physics, obj.osx, obj.w = "plt", true, true, true, true, true, -3, 10 if id == 78 then obj.rotate = false end end return obj end --particles function particles_init(n) //leaf if n == 1 or n == 6 then ptcs = {} for i = 0, 10 do add(ptcs, {x=math.random()*(128), y=math.random()*(128), x_v=-0.25*math.random()*(3)-0.25, y_v=0.25*math.random()*(3)+0.25, shape=0, clr=4+math.floor(math.random()*(2))*5, size=math.random()*(2)*0.5+1}) end //snow elseif n == 2 then ptcs = {} for i = 0, 10 do add(ptcs, {x=math.random()*(128), y=math.random()*(128), x_v=-0.25*math.random()*(3)-0.25, y_v=0.25*math.random()*(3)+0.25, shape=1, clr=6+math.random()*(2), size=math.random()*(4)*0.5+0.5}) end //transition bubble elseif n == 10 then for i = -1, 5 do for j = -1, 10 do add(ptcs, {x=j*16, y=i*32, x_v=0, y_v=0, shape=2, clr=0, size=0}) end for j = -1, 10 do add(ptcs, {x=j*16-8, y=i*32+16, x_v=0, y_v=0, shape=2, clr=0, size=0}) end end //clear else ptcs = {} end end --level load function load_level(lv) lvl = lv --< properties >-- season = data[lvl+1].season level = data[lvl+1].level clr = data[lvl+1].clr bg = data[lvl+1].bg if cheat > 1 and cheat < 6 then season = cheat-2 end --< particles >-- particles_init(bg) particles_init(10) tr_x, tr_y, tr_timer = 64, 64, -16 --< generate level >-- cam_y = level*128 room = {} if init or stat(54)==63 then music(data[lvl+1].msc) end if init then init = false add(ptcs, {x=-64, y=48, x_v=0, y_v=0, shape=11, clr=7, txt=txts[lvl*2+1], timer=32}) add(ptcs, {x=192, y=64, x_v=0, y_v=0, shape=12, clr=7, txt=txts[lvl*2+2], timer=32}) end hp, coin = 2, 0 math.randomseed(stat(95)) --generate tiles for x=0, 128 do for y=level*16, level*16+15 do tle = mget(x, y) if cheat ~= 8 then for i in all(data[lvl+1].filter) do if i == tle then mset(x, y, 0) tle = -1 end end end if fget(tle, 7) then if tle == 48 then player = create_obj(48, x, y) mset(x, y, 0) else add(room, create_obj(tle, x, y)) mset(x, y, 0) end end if tle == 240 then mset(x, y, tle + season) end end end math.randomseed(69) tr_x, tr_y = player.x+8, player.y end function palette() if season == 3 then pal(winter_pal, 0) elseif season == 2 then pal(autmun_pal, 0) elseif level == 2 then pal(cavern_pal, 0) elseif season == 1 then pal(summer_pal, 0) end end function particles_update() for p in all(ptcs) do p.x =p.x+ p.x_v --transition bubbles if p.shape == 2 then p.size = (((tr_x-p.x)^2+(tr_y-p.y)^2)^0.5 - tr_timer * 4) / 4 if p.size < 0 then p.size = 0 end if p.size > 20 then p.size = 20 end --intro text elseif p.shape == 11 then if p.x < 64 then p.x =p.x+ (64-p.x)/8 else p.timer =p.timer- 1 end if p.x > 192 then del(ptcs, p) end if math.abs(p.x - 64) < 0.5 then p.x = 64 end if p.timer <= 0 then p.x_v =p.x_v+ 0.4 player.paused = false else tr_timer = -16 player.paused = true end --intro text elseif p.shape == 12 then if p.x > 64 then p.x =p.x+ (64-p.x)/8 else p.timer =p.timer- 1 end if p.x < -64 then del(ptcs, p) end if math.abs(p.x - 64) < 0.5 then p.x = 64 end if p.timer <= 0 then p.x_v =p.x_v- 0.4 end --ending text elseif p.shape == 13 then if end_timer < 300 then if p.timer > 0 then p.timer =p.timer- 1 end elseif tr_timer < 32 then if p.timer < 39 then p.timer =p.timer+ 2 end end if p.timer < 40 then p.grad = math.floor(p.timer/10)+1 end else if p.x < cam_x then p.x =p.x+ 128 end if p.x > cam_x + 128 then p.x =p.x- 128 end p.y = (p.y + p.y_v) % 128 end end end function particles_draw() for p in all(ptcs) do if p.shape == 0 then x, y = p.x, cam_y+p.y rectfill(x,y,x+p.size,y+p.size,p.clr) elseif p.shape == 1 then x, y = p.x, cam_y+p.y circfill(x,y,p.size,p.clr) elseif p.shape == 2 and p.size > 0 then x, y = cam_x+p.x, cam_y+p.y circfill(x,y,p.size,p.clr) elseif p.shape == 11 or p.shape == 12 then x, y = cam_x+p.x, cam_y+p.y print(p.txt, x-#p.txt*2-1, y+1, 1) print(p.txt, x-#p.txt*2, y, p.clr) elseif p.shape == 13 and p.grad > 0 and p.grad <= 3 then x, y = cam_x+p.x, cam_y+p.y for i=-1,1 do for j=-1,1 do print(p.txt_1, x-#p.txt_1*2+i, y+j, grad_2[p.grad]) end end print(p.txt_1, x-#p.txt_1*2, y, grad_1[p.grad]) for i=-1,1 do for j=-1,1 do print(p.txt_2, x-#p.txt_2*2+i, y+j+10, grad_2[p.grad]) end end print(p.txt_2, x-#p.txt_2*2, y+10, grad_1[p.grad]) end end end function pp_init() cheat_list = {["⬆⬆⬇⬇⬅⬅➡➡"]={1,"hard mode"},-- ["⬆⬇⬆⬇⬅⬅⬅⬅"]={2,"spring mode"},-- ["⬆⬇⬆⬇➡⬆⬇⬅"]={3,"summer mode"},-- ["⬆⬇⬆⬇⬆⬅⬅➡"]={4,"autumn mode"},-- ["⬆⬇⬆⬇⬇⬇⬅➡"]={5,"winter mode"},-- ["⬅⬅➡➡⬆⬅➡⬅"]={6,"frogghost's adventure"},-- ["⬆⬆⬆⬇⬆⬅⬆➡"]={7,"infinite jump"},-- ["⬆➡⬅⬅➡⬇⬆⬇"]={8,"filter's day off"},-- ["➡⬆⬇⬆⬇⬆⬇⬅"]={9,"wrap around"},-- ["⬇⬅➡⬆⬅⬇➡⬆"]={10,"eater of worlds: froggo"},-- ["⬅➡⬅➡⬇⬅⬇➡"]={11,"free cam"},-- ["⬆⬅⬅⬅➡➡➡⬇"]={12,"green is not a creative color"},-- ["⬆⬇⬅⬅⬅⬆➡⬇"]={13,"h.a.t.s."},-- } hint_list = {"⬆⬇⬆⬇⬅⬅⬅⬅",-- "⬆⬇⬆⬇➡⬆⬇⬅",-- "⬆⬇⬆⬇⬆⬅⬅➡",-- "⬆⬇⬆⬇⬇⬇⬅➡",-- "⬅⬅➡➡⬆⬅➡⬅",-- "⬆⬆⬆⬇⬆⬅⬆➡",-- "⬆➡⬅⬅➡⬇⬆⬇",-- "➡⬆⬇⬆⬇⬆⬇⬅",-- "⬇⬅➡⬆⬅⬇➡⬆",-- "⬅➡⬅➡⬇⬅⬇➡",-- "⬆⬇⬅⬅⬅⬆➡⬇",-- } end -->8 --entities --player movement function player_movement() ----horizontal movement player.frame = 52 --walk animation if btn(⬅) or btn(➡) then if not player.paused then player.frame = ani_frames[math.floor(timer%12/3)+1] end end --movement if player.climb then player.x_v = 0 elseif btn(⬅) and not player.paused and player.x_v > -1.6 then player.x_v =player.x_v- 0.4 if player.t_timer <= 0 then player.face_r = false end elseif btn(➡) and not player.paused and player.x_v < 1.6 then player.x_v =player.x_v+ 0.4 if player.t_timer <= 0 and not btn(⬅) then player.face_r = true end elseif player.x_v < 0 and player.ice == 0 then player.x_v =player.x_v+ 0.4 elseif player.x_v > 0 and player.ice == 0 then player.x_v =player.x_v- 0.4 end --grounded if player.climb_cooldown > 0 then player.climb_cooldown =player.climb_cooldown- 1 end if player.grounded > 0 then player.grounded =player.grounded- 1 elseif not player.t then player.frame = 54 end ----jump if btn(🅾) and not player.paused and (player.grounded > 0 or (player.climb and player.t_timer <= 0) or cheat == 7) then player.y_v, player.grounded, player.climb, player.climb_cooldown = -6, 0, false, 4 sfx(0, 3) end if not btn(🅾) and jump_pressed and player.y_v < 0 then player.y_v =player.y_v* 0.5 end --gravity if player.y_v < 8 and not player.climb then player.y_v =player.y_v+ 0.5 end ----tongue if player.s_timer > 0 then player.s_timer =player.s_timer- 1 player.frame = 58 end if player.t_timer > 0 then player.t_timer =player.t_timer- 1 player.t_pos, player.frame = sin(player.t_timer/30)*48, 58 --catch objects for obj in all(room) do if not player.t and obj.edible and t_collide(obj) then if obj.hat ~= nil and obj.hat > 0 then add(room, create_obj(obj.hat+102, obj.x/8, obj.y/8-1)) end player.t = obj del(room, obj) end end --grapple for i=-1, 1 do for j=-1, 1 do if player.climb_cooldown <=0 and fget(mget(player.t_x/8+i, player.y/8+j), 3) then player.x, player.y = math.floor(player.t_x/8+i)*8-8, math.floor(player.y/8+j)*8 if player.face_r then player.x =player.x+ player.t_pos else player.x =player.x- player.t_pos end player.y_v, player.climb = 0, true end end end --eater of worlds if cheat == 10 then mset(player.t_x/8, player.y/8, 0) mset(player.t_x/8, player.y/8+1, 0) end end --spit tongue if player.t_timer <= 0 and player.s_timer <= 0 and btn(❎) and not x_pressed and not player.paused then if player.t then if player.t.name == "plt" then player.t.x, player.t.y, player.t.x_v, player.s_timer = player.x, player.y-10, -5, 4 if player.face_r then player.t.x_v =player.t.x_v* -1 end add(room, player.t) sfx(7,3) else sfx(3,3) end player.t = nil else player.t_timer, player.t_pos = 15, 0 sfx(1,3) end end --tongue position if player.face_r then player.t_x = player.x+8-player.t_pos else player.t_x = player.x+8+player.t_pos end --thicc walk if player.t and player.t_timer <= 0 then player.frame = ani_frames[math.floor(player.x%8/4)+5] player.frame_2 = 50 else player.frame_2 = 48 end --invincibility frames if player.inv > 0 then player.inv =player.inv- 1 end --dying if not player.alive then player.x_v = 2 if player.face_r then player.x_v = -2 end if player.y > 128+level*128 then player.x_v = 0 end player.x =player.x+ player.x_v player.y =player.y+ player.y_v end --bop if player.frame == 54 or player.frame == 56 then player.osy = -1 else player.osy = 0 end if player.ice > 0 then player.ice =player.ice- 1 end end ----object updates --physics function physics(obj) --grounded if obj.grounded > 0 then obj.grounded =obj.grounded- 1 --friction if obj.x_v < 0 then obj.x_v =obj.x_v+ 0.4 elseif obj.x_v > 0 then obj.x_v =obj.x_v- 0.4 end if math.abs(obj.x_v) < 0.4 then obj.x_v = 0 end end --gravity if obj.y_v < 8 then obj.y_v =obj.y_v+ 0.5 end end --coin function coin_update(obj) if obj.dead then obj.timer =obj.timer- 1 obj.frame = obj.timer+1 if obj.timer <= 0 then del(room, obj) end else obj.frame = 64+math.floor(timer%16/4)*2 if collide(obj, player) or t_collide(obj) then obj.dead, obj.four, obj.timer = true, true, 3 sfx(2,3) end end end --hat function hat_update(obj) if collide(obj, player) then hat = obj.type del(room, obj) end end --jim function jim_update(obj) obj.timer = (obj.timer+1)%3200 if obj.timer % 60 == 0 and obj.grounded >= 0 then obj.y_v = -7 end if obj.timer % 30 == 0 and obj.grounded >= 0 and cheat == 1 then obj.y_v = -7 end if obj.grounded <= 0 then obj.frame2 = 43 else obj.frame2 = 27 end end --ant function ant_update(obj) --roam mode if obj.step == 0 then if cheat == 1 then if obj.face_r then obj.x_v = 2 else obj.x_v = -2 end else if obj.face_r then obj.x_v = 1.5 else obj.x_v = -1.5 end end if not obj.feet.l and obj.feet.r and not obj.face_r then obj.face_r = true end if obj.feet.l and not obj.feet.r and obj.face_r then obj.face_r = false end if obj.hit_l then obj.face_r = true end if obj.hit_r then obj.face_r = false end obj.frame, obj.frame2 = 28, 44+math.floor(timer%8/4)*2 --yeet mode elseif obj.step == 1 then obj.frame, obj.frame2 = 30, 44 obj.x_v, obj.ball.y_v = 0, 0 if obj.timer < 24 then obj.timer =obj.timer+ 3 else if player.x+player.w/2 > obj.x+obj.w/2 then obj.face_r = true else obj.face_r = false end --yeet when player is close if math.abs(player.x+4 - obj.x) <= 48 then obj.ball.y_v, obj.ball.physics = -5, true if obj.face_r then obj.ball.x_v = 2 else obj.ball.x_v = -2 end obj.step = 0 sfx(7,3) end end obj.ball.x, obj.ball.y = obj.x-4, obj.y-obj.timer end obj.hit_r, obj.hit_l, obj.feet.l, obj.feet.r = false, false, false, false end --ball function ball_update(obj) if math.abs(player.x - obj.x) < 64 then for ant in all(room) do if collide(ant, obj) and ant.name == "ant" and ant.step == 0 then obj.name, obj.hurt, obj.four = "h_ball", true, true ant.step, ant.timer, ant.ball = 1, 0, obj end end end end --thrown ball function h_ball_update(obj) if not obj.physics then obj.y_v =obj.y_v+ 0.5 obj.y =obj.y+ obj.y_v elseif obj.grounded > 0 then sfx(8, 3) obj.hurt, obj.physics, obj.y_v = false, false, -3 end end --leaf function leaf_update(obj) if not obj.init then if math.floor(math.random()*(2)) == 1 then obj.face_r = true else obj.face_r = false end obj.init = true end if obj.face_r then obj.x_v = sin(timer*0.03) else obj.x_v = cos(timer*0.03) end obj.y_v = 0.5 obj.y =obj.y+ obj.y_v obj.x =obj.x+ obj.x_v if obj.y > level*128+128 then obj.y = level*128 end end --seagull function seagull_update(obj) if obj.x < player.x + 96 then obj.x_v = -1.5 obj.y_v =obj.y_v- 0.1 obj.x =obj.x+ obj.x_v obj.y =obj.y+ obj.y_v if obj.y < level*128-16 then obj.x = obj.o_x obj.y_v = 4 end end end --icicle function icicle_update(obj) if math.abs(player.x-obj.x) < 32 and obj.y_v == 0 then obj.osx = math.random()*(4)-2 else obj.osx = 0 end if math.abs(player.x-obj.x) < 20 then if obj.y_v == 0 then sfx(7, 3) end obj.osx, obj.y_v = 0, 4 end obj.y =obj.y+ obj.y_v end --checkpoint function checkpoint_update(obj) if obj.spawn then if cp then obj.spawn = false player.x, player.y = obj.x, obj.y+7 del(room, obj) else obj.spawn = false end else if not cp and player.x > obj.x then cp = true del(room, obj) end end end -- function goal_update(obj) if obj.rung then if obj.timer == 30 then sfx(3) elseif obj.timer < 30 then player.frame, player.frame_2 = 114, 98 end if not obj.music and obj.timer < 120 then obj.music = true music(63) end if obj.timer > 0 then obj.timer =obj.timer- 1 end if obj.timer <= 0 then goal = true end obj.frame = bell_frames[math.floor(timer%12/3)+1] else if collide(obj, player) or t_collide(obj, player) then obj.rung = true obj.frame = 2 player.paused = true music(-1) sfx(4) end obj.frame = 118 end end --PICO-8 Wrapper for the TIC-80 Computer --by @musurca ---------------------------------------- -- Wraps the PICO-8 API for ease of porting games -- to the TIC-80. Favors compatibility over performance. ---------------------------------------- --known issues: -- * swapping elements in the screen palette--e.g. pal(a,b,1)--doesn't work properly yet. However, pal(a,b) does work -- * flip_x and flip_y are currently ignored in spr() and sspr() -- * music() and flip() do nothing. sfx() does not take into account offset -- * stat(1) always returns "0.5" --set palette PAL_PICO8="0000001D2B537E2553008751AB52365F574FC2C3C7FFF1E8FF004DFFA300FFEC2700E43629ADFF83769CFF77A8FFCCAA" function PICO8_PALETTE() for i=0,15 do local r=tonumber(string.sub(PAL_PICO8,i*6+1,i*6+2),16) local g=tonumber(string.sub(PAL_PICO8,i*6+3,i*6+4),16) local b=tonumber(string.sub(PAL_PICO8,i*6+5,i*6+6),16) poke(0x3FC0+(i*3)+0,r) poke(0x3FC0+(i*3)+1,g) poke(0x3FC0+(i*3)+2,b) end end --sound __sfx=sfx function sfx(n,channel,offset) --does not support offset as of 0.18.0 if n<0 then __sfx(0,28,channel,0) else __sfx(0,28,channel) end end function music(n,fadems,channelmask) --do nothing as of 0.18.0 end --utility function stat(i) if i==0 then return collectgarbage("count") end return 0.5 end --strings function sub(str,i,j) return str:sub(i,j) end --permanent cart mem function cartdata(id) --do nothing end function dget(i) return pmem(i) end function dset(i,val) pmem(i,val) end --tables add=table.insert function all(list) local i = 0 return function() i = i + 1; return list[i] end end count=table.getn function del(t,a) for i,v in ipairs(t) do if v==a then t[i]=t[#t] t[#t]=nil return end end end function foreach(t, f) for v in all(t) do f(v) end end if mt ~= nil then mt = {} end --math srand=math.randomseed sqrt=math.sqrt abs=math.abs min=math.min max=math.max flr=math.floor pi=math.pi function rnd(a) a=a or 1 return math.random()*a end function sgn(a) if a>=0 then return 1 end return -1 end function cos(a) return math.cos(2*pi*a) end function sin(a) return -math.sin(2*pi*a) end function atan2(a,b) b=b or 1 return math.atan(a,b)/(2*pi) end function mid(a,b,c) if a<=b and a<=c then return max(a,min(b,c)) elseif b<=a and b<=c then return max(b,min(a,c)) end return max(c,min(a,b)) end function band(a,b) return flr(a)&flr(b) end function bor(a,b) return flr(a)|flr(b) end function bxor(a,b) return flr(a)^flr(b) end function bnot(a,b) return flr(a)~flr(b) end function shl(a,b) return a<>b end --graphics __p8_color=7 __p8_ctrans={true,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false} __p8_camera_x=0 __p8_camera_y=0 __p8_cursor_x=0 __p8_cursor_y=0 __p8_sflags={} for i=1,256 do __p8_sflags[i]=0 end function camera(cx,cy) cx=cx or 0 cy=cy or 0 __p8_camera_x=-flr(cx) __p8_camera_y=-flr(cy) end function cursor(cx,cy) cx=cx or 0 cy=cy or 0 __p8_cursor_x=flr(cx) __p8_cursor_y=flr(cy) end function __p8_coord(x,y) return flr(x+__p8_camera_x), flr(y+__p8_camera_y) end __print=print function print(str,x,y,c) x=x or __p8_cursor_x y=y or __p8_cursor_y c=c or __p8_color c=peek4(0x7FE0+c) __print(str,x,y,c) __p8_cursor_y=y+8 end function color(c) c=c or 7 __p8_color=flr(c%16) end function pal(c0,c1,type) c0=c0 or -1 c1=c1 or -1 type=type or 0 if c0<0 and c1<0 then if type==0 then for i=0,15 do poke4(0x7FE0+i,i) end else PICO8_PALETTE() end else c0=flr(c0%16) if c1<0 then c1=c0 end c1=flr(c1%16) if type==0 then poke4(0x7FE0+c0,c1) else local stri for i=0,5 do stri=#__p8_pal-(c1+1)*6+i poke4(0x3FC0*2+#__p8_pal-(c0+1)*6+i,tonumber(__p8_pal:sub(stri,stri),16)) end end end end function palt(c,trans) c=c or -1 if c<0 then -- reset __p8_ctrans[1]=true for i=2,16 do __p8_ctrans[i]=false end else __p8_ctrans[flr(c%16)+1]=trans end end function pset(x,y,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) poke4(y*240+x,c) end function pget(x,y) x,y=__p8_coord(x,y) return peek4(y*240+x) end __rect=rect function rectfill(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) local w,h=x1-x0,y1-y0 __rect(x0,y0,w+sgn(w),h+sgn(h),c) end function rect(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) local w,h=x1-x0,y1-y0 rectb(x0,y0,w+sgn(w),h+sgn(h),c) end __circ=circ function circfill(x,y,r,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) __circ(x,y,r,c) end function circ(x,y,r,c) c=c or __p8_color c=peek4(0x7FE0+c) x,y=__p8_coord(x,y) circb(x,y,r,c) end __line=line function line(x0,y0,x1,y1,c) c=c or __p8_color c=peek4(0x7FE0+c) x0,y0=__p8_coord(x0,y0) x1,y1=__p8_coord(x1,y1) __line(x0,y0,x1,y1,c) end function sspr(sx,sy,sw,sh,dx,dy,dw,dh) -- todo dw=dw or sw dh=dh or sh dx,dy=__p8_coord(dx,dy) if dx>240 or dy>136 then return end local xscale,yscale=dw/sw,dh/sh local startx,starty,c=0,0 if dx<0 then startx=-dx end if dy<0 then starty=-dy end if dx+dw>240 then dw=240-dx end if dy+dh>136 then dh=136-dy end for x=startx,dw-1 do for y=starty,dh-1 do c=sget(sx+x/xscale,sy+y/yscale) c=peek4(0x7FE0+c) if not __p8_ctrans[c+1] then poke4((dy+y)*240+dx+x,c) end end end end __spr=spr function spr(n,x,y,w,h) --todo flip_x,y w=w or 1 h=h or 1 local sx,sy,xoff,yoff=n%16*8,flr(n/16)*8,0,0 for j=0,h-1 do for i=0,w-1 do sspr(sx+xoff,sy+yoff,8,8,x+xoff,y+yoff) --__spr(n+j*16+i,x+i*8,y+j*8,__p8_ctrans) xoff=xoff+8 end yoff=yoff+8 xoff=0 end end __map=map function map(cel_x,cel_y,sx,sy,cel_w,cel_h) sx,sy=__p8_coord(sx,sy) local cel for cy=0,cel_h-1 do for cx=0,cel_w-1 do cel=mget(cx+cel_x,cy+cel_y) spr(cel,sx+cx*8,sy+cy*8) end end --__map(cel_x,cel_y,cel_w,cel_h,sx,sy,__p8_ctrans) end mapdraw=map function sset(x,y,c) x,y=flr(x),flr(y) local addr=0x8000+64*(flr(x/8)+flr(y/8)*16) poke4(addr+(y%8)*8+x%8,c) end function sget(x,y) x,y=flr(x),flr(y) local addr=0x8000+64*(flr(x/8)+flr(y/8)*16) return peek4(addr+(y%8)*8+x%8) end function flip() --do nothing end --sprite flags function fset(n,f,v) if f>7 then __p8_sflags[n+1]=f else local flags=__p8_sflags[n+1] if v then flags=flags|(1<0 then return true end return false end --input pico8ButtonMap = {} pico8ButtonMap[1] = 2 -- 0 left pico8ButtonMap[2] = 3 -- 1 right pico8ButtonMap[3] = 0 -- 2 up pico8ButtonMap[4] = 1 -- 3 down pico8ButtonMap[5] = 4 -- 4 o pico8ButtonMap[6] = 5 -- 5 x pico8ButtonMap[7] = 6 -- 6 start pico8ButtonMap[8] = 7 -- 7 Doesn't exist function pico8ButtonToTic80(i, p) if p == nil then p = 0 end return p * 8 + pico8ButtonMap[i + 1] end __btn = btn function btn(i, p) return __btn(pico8ButtonToTic80(i, p)) end __btnp = btnp function btnp(i, p) return __btnp(pico8ButtonToTic80(i, p)) end -- TIC function to call pico-8 callbacks. __updateTick = true __initalized = false function TIC() -- Initialize if __initalized == false then PICO8_PALETTE() if _init ~= nil then _init() end __initalized = true end -- Update and Draw if _update60 ~= nil then -- 60 FPS _update60() if _draw ~= nil then _draw() end elseif _update ~= nil then -- 30 FPS if __updateTick then _update() if _draw ~= nil then _draw() end end __updateTick = not __updateTick end end -- Add pico-8 cart below!