0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3 60 and startTimer < 90 or startTimer >120 and startTimer < 150 then mineT[i] = 0 DrawMine(MineAnimS[1],MinePos[i].x,MinePos[i].y) else MineShrink(MineAnimS[1],MinePos[i].x,MinePos[i].y,i) end if startTimer == 60 or startTimer == 120 then FillAllTiles() MineSpawn() end end if hasKey == false then DrawKey() end DrawExit() if wonGame == false then if hitMine == false then if mineT[1] > 60 then PlayerMove(player.xpos,player.ypos) end end end if hitMine == false then DrawPlayer(player.xpos,player.ypos) end MineCheck() CollectKey() PlayerAtGate() if hitMine == true then HitMine() end if wonGame == true then WonGame() end end lightT = 0 function DrawMine(sprite,x,y) lightT = lightT +1 local timer = lightT //60 spr(sprite,x,y,0) if timer == 0 then pix( 4 + x , 4 + y ,4) elseif timer == 1 then pix(3 + x ,4 + y ,4) elseif timer == 2 then pix( 3 + x , 3 + y ,4) elseif timer == 3 then pix(4 + x , 3 + y ,4) else lightT = 0 end end function Inst() local width = print("Intructions",0,-6) print("Intructions",((240 - width))//2,topLpix.y + 3,3,false,1) local width = print("Avoid the",0,-6) print("Avoid the",((240 - width))//2,topLpix.y + 13,3,false,1) local width = print("Landmines",0,-6) print("Landmines",((240 - width))//2,topLpix.y + 21,3,false,1) local width = print("Get Key",0,-6) print("Get Key",((240 - width))//2,topLpix.y + 29,3,false,1) local width = print("Get To Exit",0,-6) print("Get To Exit",((240 - width))//2,topLpix.y + 37,3,false,1) local width = print("'z' To Play",0,-6) print("'z' To Play",((240 - width))//2,bottomLpix.y - 8,3,false,1) if btnp(4)then menu = false inst = false end end function MineSpawn() sfx(16,'E-4',7,3) randomNum= math.random(1,#allTiles) for i=1,mineAmount,1 do local Pos = allTiles[randomNum] table.insert(MinePos,Pos) table.remove(allTiles,randomNum) randomNum = math.random(1,#allTiles) end end function MineCheck() for i=1,#MinePos,1 do if player.xpos == MinePos[i].x and player.ypos == MinePos[i].y and hitMine == false then HitMine() hitMine = true sfx(3,'B-3',30) end end end function MineShrink(sprite,x,y,index) mineT[index] = mineT[index]+1 local t = mineT[index] local timer = t //6 if timer ==0 then spr(sprite, x ,y,0) elseif timer ==1 then spr(sprite + 1, x ,y,0) elseif timer ==2 then spr(sprite + 2,x,y,0) elseif timer ==3 then spr(sprite + 3, x,y,0) elseif timer ==4 then spr(sprite + 4,x,y,0) elseif timer ==5 then spr(sprite + 5,x,y,0) end end function DrawPlayer(x,y) if wonGame == true then if gameResetT //6 % 2 == 0 then spr(258,x, y,0) else spr(259,x, y,0) end return end spr(256,x, y,0) end function PlayerMove(x,y) if player.ypos ~= topLpix.y then if btnp(0,60,6) then player.ypos = player.ypos - 8 sfx(4,'F-8',3,2) end end if player.ypos ~= bottomLpix.y -7 then if btnp(1,60,6) then player.ypos = player.ypos + 8 sfx(4,'F-8',3,2) end end if player.xpos ~= bottomLpix.x then if btnp(2,60,6) then player.xpos = player.xpos - 8 sfx(4,'F-8',3,2) end end if player.xpos ~= topRpix.x -7 then if btnp(3,60,6) then player.xpos = player.xpos + 8 sfx(4,'F-8',3,2) end end end function PlayerAtGate() if player.xpos == exitPos.x and player.ypos == exitPos.y and wonGame == false then if hasKey == true then wonGame = true music(1,0,0,false) else local width = print("Need Key",0,-6) print("Need Key",((240 - width))//2,topLpix.y + 3,3,false,1) end end end function CollectKey() if player.xpos == keyPos.x and player.ypos == keyPos.y then if hasKey == false then sfx(5,'A-5',5,2) hasKey = true end local width = print("Got Key",0,-6) print("Got Key",((240 - width))//2,topLpix.y + 3,3,false,1) end end function KeySpawn() local randomNum= math.random(1,#allTiles) local Pos = allTiles[randomNum] keyPos = Pos table.remove(allTiles,randomNum) end function ExitSpawn() local randomNum= math.random(1,#allTiles) local Pos = allTiles[randomNum] while Pos.x < 128 or Pos.y < 85 do randomNum= math.random(1,#allTiles) Pos = allTiles[randomNum] end exitPos = Pos table.remove(allTiles,randomNum) end function DrawExit() spr(exitSprite,exitPos.x, exitPos.y,0) end function DrawKey() spr(keySprite,keyPos.x, keyPos.y,0) end function HitMine() local width = print("Lost",0,-6) print("Lost",((240 - width))//2,topLpix.y + 25,3,false,1) Explode(304,player.xpos,player.ypos) gameResetT = gameResetT + 1 if gameResetT >= 120 then reset() end end function Explode(sprite,x,y) playerExplodeT = playerExplodeT+1 local t = playerExplodeT local timer = t //6 print(timer) if timer ==0 then spr(sprite, x ,y) elseif timer ==1 then spr(sprite + 1, x ,y) elseif timer ==2 then spr(sprite + 2,x , y) elseif timer ==3 then spr(sprite + 3, x , y) elseif timer ==4 then spr(sprite + 4,x , y) elseif timer ==5 then spr(sprite + 5, x , y) end end function WonGame() local width = print("Escaped",0,-6) print("Escaped",((240 - width))//2,topLpix.y + 25,3,false,1) gameResetT = gameResetT + 1 if gameResetT >= 240 then reset() end end