- }û‘L¡eÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl† 0ÿÿÿÿÿÿÿÿ2Tv˜ºÜþïÍ«‰gE#2Tv˜ºÜþ2Tv˜ºÜþ€ """"""""""""!!!!!!!""""!!!!!!""""!!!!!!!!""""""""!!!!!!!""""""""""""""""""""""""!!!!!!""""""""""""""""!!!!!!!""""""""!""""!""""""""""""""""!""""!""!""""""""""""""""""""""""""!""""!""!"""""""""""""!""""!"""""""""""""""""""""!"""!"!!"!""!""""!"!"!!"!"""!"""""!""""""""!""""!""!!""!"""!!"!!"!"""!"""!""!""""!""!""!""!""""""!!!!""!!!"!"!!""""!!""!!!"!""!!!"!"""!"""!""!""!""!!!!""!!!!"!!!""!""!"""!!!"!"!!!!!!!!"""""!!!!""""!!"""""""!!""!!!!"!"""""!!""!!""!!""!!!!!"!""!!!!!"!"!"""""!!"!"!!"!!!""!"""""!!"""!!""!""!""""""!""!""!"""!"!!"!"!!""!"""""!""!""!""!"""""!"""!""!"""!!"!!"""!!"!!!""!"""!!"!!""""""!""éABBBBBBCQRRRRRRS Á   c&&////////////////////////////   ÃÀ?"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""",0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†363 or pl.y<0 or pl.y>55 then pl.dead=true end addCoord({x=xCoord,y=yCoord}) end function addCoord(coords) table.insert(pl.coordList,1,coords) if #pl.coordList>#pl.parts then table.remove(pl.coordList,#pl.coordList) end end function spawnFruit() -- Have the fruit picka random spot on the 8x8 grid fruit.x=math.random(0,7)*8 fruit.y=math.random(0,6)*8 -- First, check if it's inside the parts -- If it is, respawn for i=1,#pl.parts,1 do local part=pl.parts[i] if fruit.x==part.x and fruit.y==part.y then spawnFruit() break end end -- Check if the fruit is on top of the player -- If it is, respawn if fruit.x==pl.x and fruit.y==pl.y then spawnFruit() end -- This prevents fruits from spawning directly -- in front of the player at the start of the game if #pl.parts==2 and fruit.y==pl.y then spawnFruit() end end function eatFruit() sfx(0) score=score+25 grow() spawnFruit() end function grow() newPart={ x=pl.newPartPos.x, y=pl.newPartPos.y } table.insert(pl.parts,#pl.parts+1,newPart) newCoord={ x=pl.parts[#pl.parts-1].x, y=pl.parts[#pl.parts-1].y } if newCoord.x>newPart.x then newCoord.x=8 elseif newCoord.xnewPart.y then newCoord.y=8 elseif newCoord.y=120 then rectf(0,2,64,12,1) rectf(0,3,64,10,2) rectf(0,4,64,8,1) printf("GAME OVER",15,5) rectf(0,16,64,19,1) rectf(0,17,64,17,2) rectf(0,18,64,15,1) if score=topScore then if f%24//12==1 then printf("TOPSCORE 0000000",0,19) printf(topScore,60-(string.len(topScore)*4)+4,19,0) end printf("NEW TOP SCORE!",4,26) end rectf(0,37,64,21,1) rectf(0,38,64,19,2) rectf(0,39,64,17,1) printf("a /Z RETRY\nb /X BACK",13,40) end end -- End of mode check end function TIC() if f==nil then BOOT() end if DEBUG then if key(64) and key (3) then pmem(0,0) pmem(1,0) pmem(2,0) end if btnp(7) then increaseTimer=not increaseTimer end end if gameSpeed==0 then gameSpeed=25 pmem(1,25) end if cursor==0 then cursor=3 pmem(2,3) end if mode=="TITLE" then if btnp(2) and cursor>1 then sfx(1) cursor=cursor-1 end if btnp(3) and cursor<4 then sfx(1) cursor=cursor+1 end if btnp(4) then gameSpeed=15+(5*(cursor-1)) pmem(1,gameSpeed) pmem(2,cursor) startGame() end elseif mode=="GAME" then if not pl.dead then if pl.x==fruit.x and pl.y==fruit.y then eatFruit() end for i=0,3,1 do if btn(i) then -- Checks if the player is trying to go backwards, -- basically if ((i==0 and pl.lastDir~=1) or (i==1 and pl.lastDir~=0)) or ((i==2 and pl.lastDir~=3) or (i==3 and pl.lastDir~=2)) then pl.dir=i end end end if f%gameSpeed//(gameSpeed-1)==1 then movePlayer() end else -- If player has died if deathTimer==5 then sfx(2) end if deathTimer==115 then if score>topScore then topScore=score pmem(0,topScore) end end if deathTimer<120 then deathTimer=deathTimer+1 else if btnp(4) then deathTimer=0 startGame() end if btnp(5) then deathTimer=0 mode="TITLE" end end end end -- End of mode check if increaseTimer then f=f+1 end draw() end -- Redefining TIC-80 functions for easier use with -- 64x64 coordinates function sprf(id,x,y,flip,transp,rot) transp=transp or -1 flip=flip or 0 rot=rot or 0 spr(id,x*2+LEFT,y*2+TOP,transp,2,flip,rot) end function rectf(x,y,w,h,c) rect(x*2+LEFT,y*2+TOP,w*2,h*2,c) end function printf(text,x,y,transp) transp=transp or 1 font(text,x*2+LEFT,y*2+TOP,transp,4,8,true,2) end function mapf(x,y,w,h,sx,sy,ckey) ckey=ckey or -1 map(x,y,w,h,sx*2+LEFT,sy*2+TOP,ckey,2,remap) end