Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pkg = {
- launch = "local prog = shell.getRunningProgram()!@#&local name = fs.getName(prog)!@#&local root = prog:sub(1, -1 - #name)!@#&if( root == \"/\" )then!@#& root = \"\"!@#&end!@#&os.loadAPI(root .. \"game/redgame\")!@#&redgame.init()!@#&local w, h = term.getSize()!@#&!@#&local cave_open = false!@#&local entered_cave = false!@#&local randomized = false!@#&local isGame = false!@#&local started = false!@#& !@#& lastvalues = {!@#& sanity = 100,!@#& hunger = 100,!@#& thirst = 100,!@#& health = 100,!@#& }!@#&!@#& sanity = {!@#& stepstaken = 0,!@#& steps = 20,!@#& decrement = 10,!@#& value = 100,!@#& }!@#&!@#& thirst = {!@#& stepstaken = 0,!@#& steps = 10,!@#& decrement = 10,!@#& value = 100,!@#& }!@#&!@#& hunger = {!@#& stepstaken = 0,!@#& steps = 15,!@#& decrement = 5,!@#& value = 100,!@#& }!@#&!@#& health = {!@#& value = 100,!@#& hunger_decrement = 0,!@#& thirst_decrement = 10,!@#& sanity_decrement = 20,!@#& hunger_decrement_value = 2,!@#& thirst_decrement_value = 5,!@#& sanity_decrement_value = 3, !@#& }!@#& !@#& stepcount = 0!@#&!@#&local isMenu = true!@#&!@#&function createRat(x,y,dmg,map,diff)!@#& local rat = {!@#& x = 0,!@#& y = 0,!@#& dmg = 0,!@#& map = \"\",!@#& hp = 100,!@#& dir = 0,!@#& bID = 17,!@#& mode=diff,!@#& mdirs = {!@#& [0] = 'down',!@#& [1] = 'up',!@#& [2] = 'right',!@#& [3] = 'left',!@#& };!@#&!@#& dispose = function(self)!@#& redgame.setPMAP(self.x,self.y,0)!@#& end,!@#&!@#& put = function(self)!@#& self.x = x!@#& self.y = y!@#& self.dmg = dmg!@#& self.map = map!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#& end,!@#&!@#& checkCollide = function(self,cx,cy)!@#& if(redgame.getPMAP()[self.y + cy][self.x + cx] == 0 and !@#& ( (redgame.getGMAP()[self.y + cy][self.x + cx] == 0) or !@#& (redgame.getGBLOCKS()[redgame.getGMAP()[self.y + cy][self.x + cx]].solid == false)))then!@#& return true!@#& else!@#& return false!@#& end!@#& end,!@#&!@#& redrawAt = function(self,cx,cy)!@#& redgame.setPMAP(self.x,self.y,0)!@#& redgame.drawMapPixel(self.y,self.x)!@#& self.x = self.x + cx!@#& self.y = self.y + cy!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#& end,!@#&!@#& moveTX = function(self)!@#& if( (self.x < player.x-1) and self:checkCollide(1,0)) then!@#& cMov = math.random(1,self.mode)!@#& if(cMov == self.mode)then self:redrawAt(1,0) end!@#& if(self.x == player.x)then!@#& self:moveTY()!@#& end!@#& end!@#&!@#& if( (self.x > player.x+1) and self:checkCollide(-1,0)) then!@#& cMov = math.random(1,self.mode)!@#& if(cMov == self.mode)then self:redrawAt(-1,0) end!@#& if(self.x == player.x)then!@#& self:moveTY()!@#& end!@#& end!@#& end,!@#&!@#& moveTY = function(self)!@#& if( (self.y < player.y) and self:checkCollide(0,1)) then!@#& cMov = math.random(1,self.mode)!@#& if(cMov == self.mode)then self:redrawAt(0,1) end!@#& if(self.y == player.y)then!@#& self:moveTX()!@#& end!@#& end!@#&!@#& if( (self.y > player.y) and self:checkCollide(0,-1)) then!@#& cMov = math.random(1,self.mode)!@#& if(cMov == self.mode)then self:redrawAt(0,-1) end!@#& if(self.y == player.y)then!@#& self:moveTX()!@#& end!@#& end!@#& end,!@#&!@#& update = function(self,tick,player,health)!@#& if(tick)then!@#& if( (self.x == player.x+1 and self.y == player.y) or (self.x == player.x-1 and self.y == player.y) ) then!@#& health.value = health.value - self.dmg!@#& end!@#& if(self.y ~= player.y)then!@#& self:moveTY()!@#& elseif(self.x ~= player.x)then!@#& self:moveTX()!@#& end!@#& return health.value!@#& end!@#& end,!@#& }!@#&!@#& return rat!@#&end!@#&!@#&statblks = {!@#& ['water'] = 18,!@#& ['food'] = 19,!@#& ['pills'] = 20,!@#& ['health'] = 21!@#&}!@#&!@#& rats = {}!@#& local gamescore = 0!@#& local intel = 3!@#&!@#&function resetStats()!@#& lastvalues = {!@#& sanity = 100,!@#& hunger = 100,!@#& thirst = 100,!@#& health = 100,!@#& }!@#& sanity = {!@#& stepstaken = 0,!@#& steps = 20,!@#& decrement = 10,!@#& value = 100,!@#& }!@#& thirst = {!@#& stepstaken = 0,!@#& steps = 10,!@#& decrement = 10,!@#& value = 100,!@#& }!@#& hunger = {!@#& stepstaken = 0,!@#& steps = 15,!@#& decrement = 5,!@#& value = 100,!@#& }!@#& health = {!@#& value = 100,!@#& hunger_decrement = 0,!@#& thirst_decrement = 10,!@#& sanity_decrement = 20,!@#& hunger_decrement_value = 2,!@#& thirst_decrement_value = 5,!@#& sanity_decrement_value = 3, !@#& }!@#& stepcount = 0!@#&end!@#&!@#&local isTick = false!@#&local lastX = 0!@#&local lastY = 0!@#&!@#&!@#&function updateSteps()!@#& if(thirst.value < 0)then thirst.value = 0 end!@#& if(hunger.value <= 0)then hunger.value = 0 end!@#& if(sanity.value < 0)then sanity.value = 0 end!@#& if(health.value <= 0)then !@#& health.value = 0 !@#& drawHud()!@#& term.setBackgroundColor(colors.black)!@#& term.setTextColor(colors.red)!@#& term.clear()!@#& term.setCursorPos((w/2) - (4), (h/2)-1)!@#& write(\"GAMEOVER\")!@#& sleep(0.6)!@#& term.setTextColor(colors.yellow)!@#& term.setCursorPos( (w/2) - ( (7 + string.len(tostring(gamescore))/2) ), (h/2)+1 )!@#& write(\" Final Score: \" .. tostring(gamescore))!@#& sleep(0.8)!@#& term.setCursorPos((w/2) - (6), (h/2)+3)!@#& term.setTextColor(colors.white)!@#& write(\"Press Any Key.\")!@#& os.pullEvent(\"key\")!@#& player:unput()!@#& resetStats()!@#& isGame = false!@#& isMenu = true!@#& started=false!@#& disposeRats()!@#& fadein(1)!@#& fadeout(0.5)!@#& startloops()!@#&!@#& end!@#&!@#& if(thirst.value > 100)then thirst.value = 100 end!@#& if(hunger.value > 100)then hunger.value = 100 end!@#& if(sanity.value > 100)then sanity.value = 100 end!@#& if(health.value > 100)then health.value = 100 end!@#&!@#& sanity.stepstaken = sanity.stepstaken + 1!@#& thirst.stepstaken = thirst.stepstaken + 1!@#& hunger.stepstaken = hunger.stepstaken + 1!@#&!@#& if(sanity.stepstaken >= sanity.steps)then!@#& sanity.value = sanity.value - sanity.decrement!@#& sanity.stepstaken = 0!@#& end!@#&!@#& if(thirst.stepstaken >= thirst.steps)then!@#& thirst.value = thirst.value - thirst.decrement!@#& thirst.stepstaken = 0!@#& end!@#&!@#& if(hunger.stepstaken >= hunger.steps)then!@#& hunger.value = hunger.value - hunger.decrement!@#& hunger.stepstaken = 0!@#& end!@#&!@#& if(sanity.value <= health.sanity_decrement)then!@#& health.value = health.value - health.sanity_decrement_value!@#& end!@#&!@#& if(hunger.value <= health.hunger_decrement)then!@#& health.value = health.value - health.hunger_decrement_value!@#& end!@#&!@#& if(thirst.value <= health.thirst_decrement)then!@#& health.value = health.value - health.hunger_decrement_value!@#& end!@#&end!@#&!@#&function game_step(player)!@#& if(player:getBlockUnder() == statblks['water'] )then!@#& gamescore = gamescore + 10!@#& if( (thirst.value + 40) <= 100)then !@#& thirst.value = thirst.value + 40 !@#& else!@#& thirst.value = 100!@#& end!@#& redgame.breakBlockAt(player.x,player.y)!@#& end!@#& if(player:getBlockUnder() == statblks['food'] )then!@#& gamescore = gamescore + 10!@#& if( (hunger.value + 40) <= 100)then !@#& hunger.value = hunger.value + 40 !@#& else!@#& hunger.value = 100!@#& end!@#& redgame.breakBlockAt(player.x,player.y)!@#& end!@#& if(player:getBlockUnder() == statblks['pills'] )then!@#& gamescore = gamescore + 10!@#& if( (sanity.value + 30) <= 100)then !@#& sanity.value = sanity.value + 30 !@#& else!@#& sanity.value = 100!@#& end!@#& redgame.breakBlockAt(player.x,player.y)!@#& end!@#& if(player:getBlockUnder() == statblks['health'] )then!@#& gamescore = gamescore + 10!@#& if( (health.value + 30) <= 100)then !@#& health.value = health.value + 30 !@#& else!@#& health.value = 100!@#& end!@#& redgame.breakBlockAt(player.x,player.y)!@#& end!@#&!@#& if( (lastX ~= player.x) or (lastY ~= player.y) )then!@#& stepcount = stepcount + 1!@#& lastX = player.x!@#& lastY = player.y!@#& updateSteps();!@#& isTick = true;!@#& end!@#&end!@#&!@#&function disposeRats()!@#& for i = 0, #rats do!@#& if(rats[i] ~= nil)then!@#& rats[i]:dispose()!@#& rats[i] = nil!@#& end!@#& end!@#&end!@#&!@#&function randomize_cave()!@#& if(redgame.getCurrentMap() == \"MAP02\")then!@#& if(not randomized)then!@#& randItems = {!@#& [0] = 18,!@#& [1] = 19,!@#& [2] = 20,!@#& [3] = 21,!@#& }!@#& disposeRats()!@#& for i = 1, math.random(5 + intel,12) do!@#& rx = math.random(5,40)!@#& ry = math.random(7,12)!@#& rats[#rats+1] = createRat(rx,ry,5 * intel,\"MAP02\",intel)!@#& rats[#rats]:put()!@#& end!@#& for i = 1, math.random(3,8) do!@#& rx = math.random(5,40)!@#& ry = math.random(7,12)!@#& if(redgame.getGMAP()[ry][rx] == 0)then!@#& redgame.setBlockAt(randItems[math.random(0,3)],rx,ry)!@#& end!@#& end!@#& !@#& redgame.addDoor(2,10, 26,17, \"MAP02\", \"MAP03\")!@#& redgame.addDoor(w-1,11, 26,17, \"MAP02\", \"MAP03\")!@#& randomized = true!@#& end!@#& end!@#&end!@#&!@#&function drawHud() !@#& term.current().setVisible(false)!@#& term.setBackgroundColor(colors.blue)!@#& term.setTextColor(colors.white)!@#& paintutils.drawFilledBox(1,1,w,4,colors.cyan)!@#& term.setCursorPos(3, 1)!@#& print(\"Sanity: \" .. tostring(sanity.value) )!@#& term.setCursorPos(3, 2)!@#& print(\"Thirst: \" .. tostring( math.abs(thirst.value - 100) ) )!@#& term.setCursorPos(3, 3)!@#& print(\"Hunger: \" .. tostring( math.abs(hunger.value - 100) ) )!@#& term.setCursorPos(3, 4)!@#& print(\"HEALTH: \" .. tostring(health.value) )!@#& term.setCursorPos(23, 4)!@#& print(\"SCORE: \" .. tostring(gamescore) ) !@#& term.current().setVisible(true) !@#&end!@#&!@#&function fadein(speed)!@#& fades = {\"black\", \"gray\", \"lightGray\", \"white\"}!@#& sleepTime = speed / #fades!@#& for i=1, #fades do!@#& term.setBackgroundColor(colors[fades[i]])!@#& term.clear()!@#& sleep(sleepTime)!@#& end!@#&end!@#&!@#&function fadeout(speed)!@#& fades = {\"white\", \"lightGray\", \"gray\", \"black\"}!@#& sleepTime = speed / #fades!@#& for i=1, #fades do!@#& term.setBackgroundColor(colors[fades[i]])!@#& term.clear()!@#& sleep(sleepTime)!@#& end!@#&end!@#&!@#&function Intro(skip) !@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"Skip intro?\",1,50)!@#& if(redgame.createYesNo(\"Yes\",\"No\",2) ~= \"ok\")then!@#& redgame.closeTextboxRaw()!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"There is a legend... a legend of a fierce\",1,50)!@#& redgame.drawTextbox(\"and evil virus called the Kone.\",2,50)!@#& redgame.closeTextbox()!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"The virus came from the rusty pneumatics\",1,50)!@#& redgame.drawTextbox(\"in old elevators it killed thousands \",2,50)!@#& redgame.drawTextbox(\"of people.. \",3,50)!@#& redgame.closeTextbox()!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"It was horrible, everyone infected..\",1,50)!@#& redgame.drawTextbox(\".. Well storys tell that those infected \",2,50)!@#& redgame.drawTextbox(\"where sent to this very island..\",3,50)!@#& redgame.closeTextbox()!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"They say they are hidden in the caves..\",1,50)!@#& redgame.drawTextbox(\"You have opened the cave, and disturbed the\",2,50)!@#& redgame.setBlockAt(15,18,11)!@#& redgame.setBlockAt(15,19,11)!@#& term.setBackgroundColor(colors.blue)!@#& redgame.drawTextbox(\"Kone. Have fun on your suicide mission.\",3,50)!@#& redgame.closeTextbox()!@#& else!@#& redgame.closeTextboxRaw()!@#& end!@#& sleep(0.5)!@#& fadein(2)!@#& redgame.setMap(\"MAP02\")!@#& fadeout(1)!@#& player:setPos(26,17)!@#& player:put()!@#& redgame.draw()!@#& randomized=false!@#& randomize_cave()!@#&end!@#&!@#&!@#&!@#&--]] Load game resources!@#&res_map01 = redgame.getResource(root .. \"maps/MAP01\")!@#&res_map02 = redgame.getResource(root .. \"maps/MAP02\")!@#&res_map03 = redgame.getResource(root .. \"maps/MAP03\")!@#&res_tileset = redgame.getResource(root .. \"maps/blocks/tileset\")!@#&!@#&--]] Create Maps!@#&redgame.addMap(\"MAP01\",res_map01,res_tileset)!@#&redgame.addMap(\"MAP02\",res_map02,res_tileset)!@#&redgame.addMap(\"MAP03\",res_map03,res_tileset)!@#&!@#&--]] Set starting map!@#&!@#&--]] Creating player / interactions!@#&player = redgame.createPlayer(1,26,17)!@#&lastX = player.x!@#&lastY = player.y!@#&!@#&--]] player:addInteraction(\"MAP01\",8,10,NPC01)!@#&!@#&function menusys()!@#& local menu = {!@#& options = {!@#& \" Easy \",!@#& \"Medium\",!@#& \" Hard \",!@#& \" Quit \",!@#& };!@#& selectedindex = 1,!@#&!@#& transition = function(self)!@#&!@#& end,!@#&!@#& update = function(self,ev) !@#& if(ev[1] == \"key\")then!@#& if(ev[2] == keys.up and self.selectedindex > 1)then!@#& self.selectedindex = self.selectedindex - 1!@#& self:draw()!@#& end!@#& if(ev[2] == keys.down and self.selectedindex < #self.options)then!@#& self.selectedindex = self.selectedindex + 1!@#& self:draw()!@#& end!@#& if(ev[2] == keys.enter)then!@#& self:transition(self.selectedindex)!@#& return self.selectedindex!@#& end!@#& end!@#& end,!@#&!@#& draw = function(self)!@#& --]] get longest menu item!@#& long=0!@#& for i=1, #self.options do!@#& if(#self.options[i] > long)then!@#& long = #self.options[i]!@#& end!@#& end!@#&!@#& --]] paint in menu box!@#& centerx = ( math.floor(w/2) - ( (long) / 2) )-2!@#& centery = ( math.floor(h/2)+6 )!@#& paintutils.drawFilledBox( !@#& centerx-1, centery-1, !@#& centerx+(long+4), centery+(#self.options),!@#& colors.lightGray)!@#&!@#& --]] draw menu upper thingy!@#& term.setCursorPos(centerx-1,centery-1)!@#& term.setTextColor(colors.gray)!@#& write(string.rep(\"@\",long+6))!@#& for i=1,#self.options do!@#& term.setCursorPos(((w/2)-2) - (#self.options[i]/2) !@#& ,centery+(i-1) )!@#& term.setTextColor(colors.black)!@#&!@#& if(self.selectedindex == i)then!@#& write(\"> \") !@#& term.setTextColor(colors.red)!@#& write(self.options[i])!@#& else!@#& write(\" \" .. self.options[i])!@#& end!@#& end!@#& --]] draw bottom thingy!@#& term.setCursorPos(centerx-1,centery+(#self.options))!@#& term.setBackgroundColor(colors.gray)!@#& write(string.rep(\" \",long+6))!@#& end,!@#& }!@#&!@#& return menu!@#&end!@#&!@#&!@#&--]] Game loop!@#&function startloops()!@#& setuptitle()!@#& menu:draw()!@#&!@#& while isMenu and not isGame do!@#& events = {os.pullEvent()}!@#& val = menu:update(events)!@#&!@#& if(val == 1)then!@#& intel = 4!@#& elseif(val == 2)then!@#& intel = 3!@#& elseif(val == 3)then!@#& intel = 2!@#& elseif(val == 4)then!@#& isMenu = false!@#& fadein(0.5)!@#& fadeout(0.5)!@#& term.setTextColor(colors.white)!@#& term.setCursorPos(1,1)!@#& end!@#&!@#& if(val == 1 or val == 2 or val == 3)then!@#& started = false!@#& isMenu = false!@#& isGame = true!@#& fadein(0.5)!@#& fadeout(0.5)!@#& break!@#& end!@#&!@#& if(events[1] == 'timer')then!@#& term.current().setVisible(false)!@#& timer = os.startTimer(2)!@#& if(animindex == 6)then !@#& animindex = 1 !@#& else!@#& animindex = animindex + 1 !@#& end!@#& paintutils.drawImage(animation[animindex],1,1)!@#& menu:draw()!@#& term.current().setVisible(true)!@#& end!@#& end!@#& !@#& while isGame and not isMenu do!@#& startgame()!@#&!@#& game_step(player)!@#& --]] Draw HUD!@#& drawHud()!@#& --]] Update player!@#& player:update()!@#&!@#& if(redgame.getCurrentMap() == \"MAP03\")then!@#& disposeRats()!@#& randomized=false!@#& redgame.setMap(\"MAP02\")!@#& player:setPos(26,17)!@#& end!@#&!@#& if(isTick)then!@#& gamescore = gamescore + 1!@#& --]] Update enemys!@#& for i = 0, #rats do!@#& if(rats[i] ~= nil)then!@#& health.value = rats[i]:update(isTick,player,health)!@#& end!@#& end!@#& isTick = false!@#& end!@#&!@#& if(player.y > 17) then player:moveUp(1) end!@#&!@#& --]] Generate random obstacles when entering cave!@#& randomize_cave()!@#&!@#& game_step(player)!@#& end!@#&end!@#&!@#&function startgame()!@#& if(not started)then!@#& redgame.setMap(\"MAP01\")!@#& redgame.draw()!@#& started=true!@#& Intro()!@#& end!@#&end!@#&!@#&function setuptitle()!@#& menu = menusys(nil,nil,nil)!@#& menu:draw()!@#& --]] clear screen and draw title!@#& term.setBackgroundColor(colors.black)!@#& term.setTextColor(colors.white)!@#& term.clear()!@#& timer = os.startTimer(2)!@#&!@#& animation = {!@#& [1] = paintutils.loadImage(root .. \"game/title/anim0\"),!@#& [2] = paintutils.loadImage(root .. \"game/title/anim1\"),!@#& [3] = paintutils.loadImage(root .. \"game/title/anim2\"),!@#& [4] = paintutils.loadImage(root .. \"game/title/anim3\"),!@#& [5] = paintutils.loadImage(root .. \"game/title/anim4\"),!@#& [6] = paintutils.loadImage(root .. \"game/title/anim5\"),!@#& }!@#& animindex = 1!@#& paintutils.drawImage(animation[animindex],1,1)!@#&end!@#&!@#&startloops()",
- game = {
- oldhud = "function drawHud() !@#& if ((sanity.value ~= lastvalues.sanity) or !@#& (thirst.value ~= lastvalues.thirst) or!@#& (hunger.value ~= lastvalues.hunger) or!@#& (health.value ~= lastvalues.health)!@#& ) then!@#& term.setBackgroundColor(colors.blue)!@#& term.setTextColor(colors.white)!@#& paintutils.drawFilledBox(2,2,w-2,6,colors.cyan)!@#& !@#& term.setCursorPos(3, 2)!@#& print(\"Sanity: \" .. tostring(sanity.value) )!@#& term.setCursorPos(3, 3)!@#& print(\"Thirst: \" .. tostring( math.abs(thirst.value - 100) ) )!@#& term.setCursorPos(3, 4)!@#& print(\"Hunger: \" .. tostring( math.abs(hunger.value - 100) ) )!@#& term.setCursorPos(10, 6)!@#& print(\"HEALTH: \" .. tostring(health.value) ) !@#& lastvalues = {!@#& sanity = sanity.value,!@#& hunger = hunger.value,!@#& thirst = thirst.value,!@#& health = health.value,!@#& }!@#& end!@#&end!@#&!@#& if(entered_cave == false and redgame.getCurrentMap() == \"MAP02\")then!@#& entered_cave = true!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"The door slams shut behind you!\",1,20)!@#& redgame.drawTextbox(\"You try to open it but its stuck.\",2,20)!@#& redgame.drawTextbox(\"The thought that this was a bad idea dawns\",3,20)!@#& redgame.drawTextbox(\"on you. You must find a way out!\",4,20)!@#& redgame.closeTextbox()!@#& end!@#&!@#&!@#& if( (self.y ~= player.y) ) then !@#& if(self.y > player.y-1)then!@#& if(self:checkCollide(0,-1))then!@#& redgame.setPMAP(self.x,self.y,0)!@#& redgame.drawMapPixel(self.y,self.x)!@#& self.y = self.y - 1!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#&!@#& if(self.y == player.y)then!@#& if(self.x > player.x-1)then!@#& if(self:checkCollide(-1,0))then!@#& redgame.setPMAP(self.x,self.y,0)!@#& redgame.drawMapPixel(self.y,self.x)!@#& self.x = self.x - 1!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#& end!@#& end!@#& end!@#& end!@#&!@#& elseif(self.y < player.y+1)then!@#&!@#& if(self:checkCollide(0,1))then!@#& redgame.setPMAP(self.x,self.y,0)!@#& redgame.drawMapPixel(self.y,self.x)!@#& self.y = self.y + 1!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#& if(self.y == player.y)then!@#& if(self.x < player.x+1)then!@#& if(self:checkCollide(1,0))then!@#& redgame.setPMAP(self.x,self.y,0)!@#& redgame.drawMapPixel(self.y,self.x)!@#& self.x = self.x + 1!@#& redgame.setPMAP(self.x,self.y,self.bID)!@#& redgame.drawMapPixel(self.y,self.x)!@#& end!@#& end!@#& end!@#& end!@#&!@#& !@#& if(result == \"ok\")then!@#&!@#& ocave = redgame.createYesNo(\"Open the cave!\",\"Oh wow\",2)!@#& if(ocave == \"ok\")then!@#& redgame.closeTextboxRaw()!@#& redgame.openTextbox()!@#& redgame.drawTextbox(\"Woah are you crazy?!? fine i will\",1,50)!@#&!@#& cave_open = true!@#& !@#& redgame.setBlockAt(15,18,11)!@#& redgame.setBlockAt(15,19,11)!@#& redgame.addDoor(18,11, 26,17, \"MAP01\", \"MAP02\")!@#& redgame.addDoor(19,11, 26,17, \"MAP01\", \"MAP02\")!@#& else!@#& redgame.closeTextboxRaw()!@#& end!@#& else!@#&!@#& end!@#& else!@#& redgame.drawTextbox(\"Go on already, i thought you wanted to die?\",1,80)!@#& redgame.closeTextbox()!@#& end!@#& !@#& redgame.closeTextbox()",
- title = {
- anim1 = "707e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&080e77777e777777e777777e777777e7e77e777e77e777777!@#&707e77777eeee777e7eee77eeee777e7ee7e777e77e777777!@#&777e77777e777777e777e77e777777e77eee777e77e777777!@#&777eeee77eeee777eeeee77eeee777e777ee777eee7777777!@#&88800007700d1777000007700007770777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- anim5 = "777e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&777e77777e777777e777777e777777e7e77e777e77e777777!@#&777e77777eeee777e7eee77eeee777e7ee7e777e77e777777!@#&777e77777e777777e777e77e777707e77eee777e77e777777!@#&777eeee77eeee777eeeee77eeee080e777ee777eee7777777!@#&88800007700d1777000007700007070777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- anim3 = "777e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&777e77777e777777e777777e777777e7e77e777e77e707777!@#&777e77777eeee777e7eee77eeee777e7ee7e777e77e080777!@#&777e77777e777777e777e77e777777e77eee777e77e707777!@#&777eeee77eeee777eeeee77eeee777e777ee777eee7777777!@#&88800007700d1777000007700007770777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- anim2 = "777e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&777e77077e777777e777777e777777e7e77e777e77e777777!@#&777e70807eeee777e7eee77eeee777e7ee7e777e77e777777!@#&777e77077e777777e777e77e777777e77eee777e77e777777!@#&777eeee77eeee777eeeee77eeee777e777ee777eee7777777!@#&88800007700d1777000007700007770777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- anim0 = "777e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&777e77777e777777e777777e777777e7e77e777e77e777777!@#&777e77777eeee777e7eee77eeee777e7ee7e777e77e777777!@#&777e77777e777777e777e77e777777e77eee777e77e777777!@#&777eeee77eeee777eeeee77eeee777e777ee777eee7777777!@#&88800007700d1777000007700007770777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- anim4 = "777e77777eeee777eeeee77eeee777eee77e777eee7777777!@#&777e77777e777777e777770e777777e7e77e777e77e777777!@#&777e77777eeee777e7eee080eee777e7ee7e777e77e777777!@#&777e77777e777777e777e70e777777e77eee777e77e777777!@#&777eeee77eeee777eeeee77eeee777e777ee777eee7777777!@#&88800007700d1777000007700007770777007770008888888!@#& 888888881881118888888888888888888888888!@#& 11d1!@#& 11d 111 1!@#& dd1 11 dd 1 d11 d d11!@#& 1 11 1 1 1 1 11 1 11!@#& 1 1 dd 1 1 11 11d!@#& 1111 dd 1d1 1 111!@#& 1 d1 11d1!@#& 11",
- },
- redgame = "--]] RedGame API By: Redxone[[--!@#&!@#&function init()!@#& w,h = term.getSize()!@#& pmap = {}!@#& for i = 1, h do!@#& pmap[i] = {}!@#& for c = 1, w do!@#& pmap[i][c] = 0!@#& end !@#& end!@#&!@#& gmap = {}!@#& emp={}!@#& gplayer={}!@#& gblocks={}!@#& doors={}!@#& maps={}!@#& mapName = \"\"!@#&!@#&end!@#&!@#&function getGMAP()!@#& return gmap!@#&end!@#&!@#&function getPMAP()!@#& return pmap!@#&end!@#&!@#&function getGBLOCKS()!@#& return gblocks!@#&end!@#&!@#&function setPMAP(x,y,id)!@#& pmap[y][x] = id!@#&end!@#&!@#&function setGMAP(x,y,id)!@#& gmap[y][x] = id!@#&end!@#&!@#&function openTextbox()!@#& paintutils.drawBox(1,h-5,w,h,colors.gray)!@#& paintutils.drawFilledBox(2,h-4,w-1,h-1,colors.blue)!@#&end!@#&!@#&clearTextbox = openTextbox!@#&!@#&function drawTextbox(text,ln,speed)!@#& term.setCursorPos(6,h- ( 4 - ( ln-1 ) ) )!@#& term.setTextColor(colors.white)!@#& textutils.slowPrint(text,speed)!@#&end!@#&!@#&function createYesNo(YText,NText,ln)!@#& local sel = 1!@#& local waiting = true!@#& local opt = {!@#& {name=YText};!@#& {name=NText};!@#& }!@#&!@#& function waitResult()!@#& while waiting do!@#& for i = 1, #opt do!@#& term.setCursorPos((w/2) - #opt[i].name/2,h- ( 4 - ( (ln+i)-1 ) ) )!@#& if(sel == i )then!@#& write(\"[\"..opt[i].name..\"]\")!@#& else!@#& write(\" \"..opt[i].name..\" \")!@#& end!@#& end!@#&!@#& a = {os.pullEvent(\"key\")}!@#&!@#& if(a[2] == keys.w and sel > 1)then!@#& sel = sel - 1!@#& end!@#& if(a[2] == keys.s and sel < #opt)then!@#& sel = sel + 1!@#& end!@#& if(a[2] == keys.space)then!@#& if(sel == 1)then waiting = false return \"ok\" end!@#& if(sel == 2)then waiting = false return \"no\" end!@#& end!@#& end!@#& end!@#& return waitResult()!@#&end!@#&!@#&!@#&function addDoor(fromx,fromy,tox,toy,fromMap,toMap)!@#& doors[#doors+1] = {fx=fromx,fy=fromy,tx=tox,ty=toy,fMap=fromMap,tMap=toMap}!@#&end!@#&!@#&function draw()!@#&!@#& for i = 1, #gmap do!@#& for c = 1, #gmap[i] do!@#& term.setCursorPos(c,i)!@#& term.setTextColor(colors[ gblocks[ gmap[i][c] ].color ])!@#& term.setBackgroundColor(colors[ gblocks[ gmap[i][c] ].bcolor ])!@#& write(gblocks[ gmap[i][c] ].graphic)!@#& end!@#& end!@#&!@#& for i = 1, #pmap do!@#& for c = 1, #pmap[i] do!@#& if(pmap[i][c] ~= 0)then!@#& term.setCursorPos(c,i)!@#& term.setTextColor(colors[ gblocks[ pmap[i][c] ].color ])!@#& term.setBackgroundColor(colors[ gblocks[ pmap[i][c] ].bcolor ])!@#& write(gblocks[ pmap[i][c] ].graphic)!@#& end!@#& end!@#& end!@#&!@#&end!@#&!@#&!@#&function closeTextbox()!@#& os.pullEvent(\"key\")!@#& draw()!@#& term.setCursorPos(1,h)!@#& term.setBackgroundColor(colors[gblocks[0].bcolor])!@#& term.clearLine()!@#&end!@#&!@#&function closeTextboxRaw()!@#& draw()!@#& term.setCursorPos(1,h)!@#& term.setBackgroundColor(colors[gblocks[0].bcolor])!@#& term.clearLine()!@#&end!@#&!@#&!@#&function drawMapPixel(x,y)!@#& term.setCursorPos(y,x)!@#& term.setTextColor(colors[ gblocks[ gmap[x][y] ].color ])!@#& term.setBackgroundColor(colors[ gblocks[ gmap[x][y] ].bcolor ])!@#& write(gblocks[ gmap[x][y] ].graphic)!@#& if(pmap[x][y] ~= 0)then!@#& term.setCursorPos(y,x)!@#& term.setTextColor(colors[ gblocks[ pmap[x][y] ].color ])!@#& term.setBackgroundColor(colors[ gblocks[ pmap[x][y] ].bcolor ])!@#& write(gblocks[ pmap[x][y] ].graphic)!@#& end!@#&end!@#&!@#&function lookupBlock(id)!@#& for i = 1, #gmap do!@#& for c = 1, #gmap[i] do!@#& if(gmap[i][c] == id)then return true end!@#& end!@#& end!@#& return false!@#&end!@#&!@#&function findBlockAt(id)!@#& inf = {}!@#& for i = 1, #gmap do!@#& for c = 1, #gmap[i] do!@#& if(gmap[i][c] == tonumber(id))then !@#& return i,c !@#& end!@#& end!@#& end!@#& return nil!@#&end!@#&!@#&function getBlockAt(x,y)!@#& return gmap[y][x]!@#&end!@#&!@#&function setBlockAt(id,x,y)!@#& gmap[y][x] = id!@#& drawMapPixel(y,x)!@#&end!@#&!@#&function breakBlockAt(x,y)!@#& gmap[y][x] = 0!@#& drawMapPixel(y,x)!@#&end!@#&!@#&function editBlock(id,color,bcolor,graphic,solid)!@#& gblocks[id].color = color!@#& gblocks[id].bcolor = bcolor!@#& gblocks[id].graphic = graphic!@#& gblocks[id].solid = solid!@#& draw()!@#&end!@#&function getCurrentMap()!@#& return mapName!@#&end!@#&!@#&!@#&function addMap(name,levmap,blocks)!@#& if(maps[name] ~= nil)then error(\"[Redgame] - > AddMap - > Map already added!\") end!@#& maps[name] = {level=levmap,blockmap=blocks}!@#&end!@#&!@#&function setSolid(id,solid)!@#& gblocks[id].solid = solid!@#&end!@#&!@#&function getResource(file)!@#& f = fs.open(file,\"r\")!@#& res = textutils.unserialize(f.readAll())!@#& f.close()!@#& if(type(res) ~= \"table\")then error(\"[RedGame]: getResource -> file [\"..file..\"] must contain only a table!\") end!@#& return res!@#&end!@#&!@#&function setMap(map)!@#& if(maps[map] == nil)then!@#& error(\"[RedGame] -> setMap -> No such map.\")!@#& end!@#& gmap=maps[map].level!@#& mapName = map!@#& gblocks = maps[map].blockmap!@#& draw()!@#&end!@#&!@#&function getMap()!@#& return gmap!@#&end!@#&!@#&!@#&!@#&!@#&function createPlayer(block,startX,startY)!@#&!@#& local player = {!@#&!@#& x=startX,!@#& y=startY,!@#& tickrate=tonumber(0.1),!@#& physicsTick = os.startTimer(0.1),!@#& jump_height=2,!@#& hspd = 0,!@#& vspd = 0,!@#& blockid = block,!@#& multidir = false,!@#& physic_control= {!@#& [\"direction_up\"] = keys.w,!@#& [\"direction_down\"] = keys.s,!@#& [\"direction_left\"] = keys.a,!@#& [\"direction_right\"] = keys.d,!@#& },!@#& lastMove = \"player_up\",!@#& events = {},!@#& interactions ={},!@#&!@#& addInteraction = function(self,mydmap,x,y,func)!@#& self.interactions[#self.interactions+1] = {onmap=mydmap,x=x,y=y,active=true,event=func}!@#& end,!@#&!@#& removeInteraction = function(self,mydmap,x,y)!@#& for i = 1, #self.interactions do!@#& if(self.interactions[i].x == x and self.interactions[i].y == y and self.interactions[i].onmap == mydmap)then!@#& self.interactions[i].active=false;!@#& end!@#& end !@#& end,!@#&!@#& setPhysicsTick = function(self,time)!@#& self.tickrate = tonumber(time)!@#& self.physicsTick = os.startTimer(time)!@#& end,!@#&!@#& addEvent = function(self,check,evfunc)!@#& table.insert(self.events,{type=check,run=evfunc})!@#& end,!@#&!@#& getBlockUnder = function(self)!@#& if(gmap[self.y][self.x] ~= 0)then!@#& return gmap[self.y][self.x]!@#& end!@#& return 0!@#& end,!@#&!@#&!@#& checkCollision = function(self,x,y)!@#& hasColl = false!@#& if( gblocks[gmap[y][x]].solid or pmap[y][x] ~= 0)then hasColl = true end!@#& if( gmap[y][x] == 0 and pmap[y][x] == 0)then hasColl = false end!@#& return hasColl!@#& end,!@#&!@#& jump = function(self,ammount)!@#& if(self:checkCollision(self.x,self.y+1))then!@#& for i = 1, ammount do!@#& if(not self:checkCollision(self.x,self.y-1))then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.y = self.y - 1!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end!@#& end!@#& end!@#& end,!@#&!@#& moveUp=function(self,ammount)!@#& if(not self:checkCollision(self.x,self.y-1) and not self:checkPhysics(\"gravity\"))then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.y = self.y - ammount!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end!@#&!@#& if(not self:checkCollision(self.x,self.y-1) and self:checkPhysics(\"gravity\"))then!@#& self:jump(self.jump_height)!@#& end!@#& end,!@#&!@#& moveDown=function(self,ammount)!@#& if(not self:checkCollision(self.x,self.y+1))then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.y = self.y + ammount!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end !@#& !@#& end,!@#&!@#& moveLeft=function(self,ammount)!@#& --pmap[self.y][self.x-1] == 0!@#& if(not self:checkCollision(self.x-1,self.y))then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.x = self.x - ammount!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end !@#&!@#&!@#& end,!@#&!@#& moveRight=function(self,ammount)!@#& if(not self:checkCollision(self.x+1,self.y))then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.x = self.x + ammount!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end !@#& end,!@#&!@#&!@#& physics = {!@#&!@#& [\"gravity\"] = {has=false,func=function(self) !@#& if(not self:checkCollision(self.x,self.y+1))then!@#& self:moveDown(1)!@#& sleep(0.01)!@#& end!@#& end};!@#&!@#& [\"smooth_experimental\"] = {has=false,func=function(self) !@#& self.multidir = true!@#& self.physics[\"smooth_experimental\"].has = false!@#& end};!@#&!@#& },!@#&!@#&!@#& checkPhysics = function(self,element)!@#& for k, v in pairs(self.physics) do!@#& if(k == element and v.has)then!@#& return true!@#& end!@#& end!@#&!@#& return false!@#& end,!@#&!@#& checkInteract = function(self)!@#& for i = 1, #self.interactions do!@#& if( ((self.y == self.interactions[i].y-1) !@#& and (self.x == self.interactions[i].x)) !@#& or ((self.y == self.interactions[i].y+1)!@#& and (self.x == self.interactions[i].x))!@#& or ((self.y == self.interactions[i].y)!@#& and (self.x == self.interactions[i].x+1))!@#& or ((self.y == self.interactions[i].y)!@#& and (self.x == self.interactions[i].x-1))!@#& )then!@#& if(self.interactions[i].onmap == getCurrentMap() and self.interactions[i].active)then!@#& self.interactions[i].event()!@#& end!@#& end!@#& end!@#& end,!@#&!@#& controls = {!@#& {name = \"player_interact\",event=\"key\",key=keys.space,func=function(self) self:checkInteract() end};!@#& {name=\"player_up\",event=\"key\",key=keys.w,func=function(self) self.lastMove = \"player_up\" self:moveUp(1) end};!@#& {name=\"player_down\",event=\"key\",key=keys.s,func=function(self) self.lastMove = \"player_down\" self:moveDown(1) end};!@#& {name=\"player_left\",event=\"key\",key=keys.a,func=function(self) self.lastMove = \"player_left\" self:moveLeft(1) end};!@#& {name=\"player_right\",event=\"key\",key=keys.d,func=function(self)self.lastMove = \"player_right\" self:moveRight(1) end};!@#& },!@#&!@#& --]] movement functions!@#&!@#& put = function(self)!@#& pmap[self.y][self.x] = self.blockid !@#& end,!@#&!@#& unput = function(self)!@#& pmap[self.y][self.x] = 0; !@#& drawMapPixel(self.y,self.x)!@#& end,!@#&!@#& applyPhysics = function(self,element)!@#& if(self.physics[element] ~= nil)then!@#& if(self.physics[element].has == false)then!@#& self.physics[element].has = true!@#& end!@#& else!@#& error(\"[RedGame]: player -> addPhysicsElement -> no such element!\")!@#& end!@#& end,!@#&!@#& setJumpHeight = function(self,h)!@#& self.jump_height = h!@#& end,!@#&!@#& createPhysics = function(self,element,physic)!@#& if(self.physics[element] ~= nil)then error(\"[RedGame]: player - > createPhysicsElement -> element already exists!\") end!@#& if(type(physic) ~= \"table\")then error(\"[RedGame]: player -> createPhysicsElement -> must be in table format eg {func=function(self) physics stuff end};\") end!@#& metaindex = {has=false,func=function(self) end};!@#& physic = setmetatable(physic, {__index = metaindex})!@#& self.physics[element] = physic!@#& end,!@#&!@#& remapPhysicsControl = function(self,name,to)!@#& if(self.physic_control[name])then!@#& self.physic_control[name] = to!@#& else!@#& error(\"[RedGame]: player -> remapPhysicsControl invalid control!\")!@#& end!@#& end,!@#&!@#& remapControl = function(self,name,to)!@#& for i = 1, #self.controls do!@#& if(self.controls[i].name == name)then!@#& self.controls[i].key = to!@#& end!@#& end!@#& end,!@#&!@#& addControl=function(self,controltable)!@#& if(type(controltable) ~= \"table\")then!@#& error(\"[RedGame]:addControl -> control must be a table in this format: {name=<control name>,event=<event>,key=<key in string format>,func=function() <actions> end}\")!@#& else!@#& table.insert(self.controls,controltable)!@#& end!@#& end,!@#&!@#& importControls=function(self,controltable)!@#& if(type(controltable) ~= \"table\")then!@#& error(\"[RedGame]:importControls -> control must be a table in this format: controls = { {name=<control name>,event=<event>,key=<key in string format>,func=function() <actions> end}, ect... }\")!@#& else!@#& self.controls = controltable!@#& end!@#& end,!@#&!@#&!@#& setPos = function(self,x,y)!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& self.x = x!@#& self.y = y!@#& self:checkCollision(self.x,self.y)!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end,!@#&!@#& update=function(self)!@#&!@#& for i = 1, #doors do!@#& if(getCurrentMap() == doors[i].fMap and self.x == doors[i].fx and self.y == doors[i].fy)then!@#& setMap(doors[i].tMap)!@#& self:setPos(doors[i].tx,doors[i].ty)!@#& end!@#& end!@#&!@#& if(self.multidir)then!@#& pmap[self.y][self.x] = 0!@#& drawMapPixel(self.y,self.x)!@#& if(not self:checkCollision(self.x+self.hspd,self.y))then!@#& self.x = self.x + self.hspd!@#& end!@#& if(not self:checkCollision(self.x,self.y+self.vspd))then!@#& self.y = self.y + self.vspd!@#& end!@#& pmap[self.y][self.x] = self.blockid!@#& drawMapPixel(self.y,self.x)!@#& end!@#&!@#& a = {os.pullEvent()}!@#&!@#& for k, v in pairs(self.events) do!@#& if(v.type == a[1])then!@#& v.run(a)!@#& end!@#& end!@#&!@#& if(a[1]==\"timer\")then!@#& self.physicsTick=os.startTimer(self.tickrate)!@#& for k, v in pairs(self.physics) do!@#& if(v.has)then v.func(self) end!@#& end!@#& end!@#&!@#& if(not self.multidir)then!@#& for i = 1, #self.controls do!@#& if(a[1] == self.controls[i].event and a[2] == self.controls[i].key)then!@#& self.controls[i].func(self)!@#& end!@#& end !@#& end!@#&!@#& if(self.multidir)then!@#& if(a[2] ~= self.physic_control[\"direction_up\"] and a[2] ~= self.physic_control[\"direction_down\"])then!@#& self.vspd = 0!@#& end!@#& if(a[2] ~= self.physic_control[\"direction_left\"] and a[2] ~= self.physic_control[\"direction_right\"])then!@#& self.hspd = 0!@#& end!@#& if(a[2] == self.physic_control[\"direction_up\"])then!@#& if(self:checkPhysics(\"gravity\"))then!@#& if(self:checkCollision(self.x,self.y+1))then!@#& self.vspd = -self.jump_height!@#& end!@#& else!@#& self.vspd = -self.jump_height!@#& end!@#& end!@#& if(a[2] == self.physic_control[\"direction_down\"])then!@#& self.vspd = 1!@#& end!@#& if(a[2] == self.physic_control[\"direction_left\"])then!@#& self.hspd = -1!@#& end!@#& if(a[2] == self.physic_control[\"direction_right\"])then!@#& self.hspd = 1!@#& end!@#& end!@#& end,!@#&!@#& }!@#&!@#& return player!@#&end",
- },
- maps = {
- MAP04 = "{{16,16,16,2,2,2,10,10,10,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{16,16,2,2,2,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,},{16,2,2,2,10,10,0,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,},{16,2,2,10,10,10,0,0,0,19,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,},{16,2,2,10,10,10,0,18,0,21,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,},{16,2,2,10,10,10,0,19,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,},{16,2,2,10,10,10,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,},{2,2,2,10,10,10,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,16,16,0,},{2,2,2,10,10,10,0,0,21,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{2,2,2,10,10,10,0,0,0,0,18,19,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{2,2,2,10,10,10,0,0,0,0,0,21,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,2,2,2,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,16,16,2,2,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,0,},{0,0,0,0,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,0,0,0,0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,16,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},}",
- blocks = {
- tileset = "{!@#& {!@#& solid = true,!@#& name = \"Player\",!@#& color = \"blue\",!@#& graphic = \"@\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Dirt\",!@#& color = \"yellow\",!@#& graphic = \" \",!@#& bcolor = \"brown\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Stone\",!@#& color = \"lightGray\",!@#& graphic = \"@\",!@#& bcolor = \"gray\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Sand\",!@#& color = \"white\",!@#& graphic = \"+\",!@#& bcolor = \"yellow\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Scifi\",!@#& color = \"purple\",!@#& graphic = \"0\",!@#& bcolor = \"blue\",!@#& },!@#& {!@#& solid = false,!@#& name = \"Grass\",!@#& color = \"green\",!@#& graphic = \"*\",!@#& bcolor = \"brown\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Iron\",!@#& color = \"white\",!@#& graphic = \"/\",!@#& bcolor = \"lightGray\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Gravel\",!@#& color = \"white\",!@#& graphic = \"G\",!@#& bcolor = \"brown\",!@#& },!@#& {!@#& solid = true,!@#& name = \"Quartz\",!@#& color = \"lightGray\",!@#& graphic = \"X\",!@#& bcolor = \"white\",!@#& },!@#& {!@#& solid = true,!@#& name = \"cliff\",!@#& color = \"gray\",!@#& graphic = \"#\",!@#& bcolor = \"brown\",!@#& },!@#& {!@#& solid = false,!@#& name = \"shore\",!@#& color = \"blue\",!@#& graphic = \"*\",!@#& bcolor = \"yellow\",!@#& },!@#& {!@#& solid = false,!@#& name = \"sand\",!@#& color = \"yellow\",!@#& graphic = \" \",!@#& bcolor = \"yellow\",!@#& },!@#& {!@#& solid = true,!@#& name = \"water\",!@#& color = \"blue\",!@#& graphic = \" \",!@#& bcolor = \"blue\",!@#& },!@#& {!@#& solid = true,!@#& name = \"barrier\",!@#& color = \"brown\",!@#& graphic = \"X\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = false,!@#& name = \"cave\",!@#& color = \"black\",!@#& graphic = \" \",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = true,!@#& name = \"MazeWall\",!@#& color = \"gray\",!@#& graphic = \"=\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = true,!@#& name = \"rat\",!@#& color = \"red\",!@#& graphic = \"&\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = false,!@#& name = \"water\",!@#& color = \"blue\",!@#& graphic = \"[\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = false,!@#& name = \"food\",!@#& color = \"brown\",!@#& graphic = \"*\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = false,!@#& name = \"pills\",!@#& color = \"purple\",!@#& graphic = \":\",!@#& bcolor = \"black\",!@#& },!@#& {!@#& solid = false,!@#& name = \"healthpack\",!@#& color = \"red\",!@#& graphic = \"+\",!@#& bcolor = \"black\",!@#& },!@#& [ 0 ] = {!@#& solid = false,!@#& name = \"Air\",!@#& color = \"black\",!@#& graphic = \" \",!@#& bcolor = \"black\",!@#& },!@#&}",
- },
- MAP01 = "{{13,13,13,13,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,13,13,13,},{13,13,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,13,},{13,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,6,13,},{13,6,6,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,6,6,13,},{13,13,6,6,6,6,6,5,6,6,6,6,6,6,6,10,10,10,10,10,10,6,6,6,6,6,6,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,6,6,6,13,},{11,13,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,14,14,10,6,6,6,6,6,6,6,6,6,6,6,10,10,10,10,10,10,10,10,10,10,10,10,6,6,6,6,6,6,6,13,},{11,13,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,10,10,10,10,10,10,10,10,6,6,6,6,6,6,6,6,13,},{13,13,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,10,10,10,10,6,6,6,6,6,6,6,6,12,12,13,},{13,11,12,12,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,13,},{13,11,11,12,12,12,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,11,13,13,},{13,13,11,11,11,11,12,12,12,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,11,13,13,13,13,},{13,13,13,13,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,6,6,6,6,6,6,12,11,11,13,13,13,13,13,},{13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,13,13,13,13,13,},}",
- MAP03 = "{{14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,0,0,0,3,3,0,3,3,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,3,0,0,0,3,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,3,3,0,3,3,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,21,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,0,3,3,3,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,14,},{14,0,0,0,0,18,0,0,0,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,0,0,0,0,3,0,0,0,0,0,3,0,0,0,3,3,3,3,0,0,0,20,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,0,3,3,0,3,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,},{14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,0,0,3,0,3,3,3,3,0,0,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,14,},{14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,},}",
- cavetemplate = "{{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,0,0,16,0,0,16,0,0,0,16,0,0,16,0,0,0,16,0,16,0,0,0,0,16,0,0,16,16,0,16,16,0,0,0,16,0,0,0,16,16,0,0,0,16,16,16,0,0,0,16,},{16,0,0,16,0,0,16,0,0,0,0,16,16,0,0,0,0,16,0,16,0,0,0,0,16,0,0,16,0,16,0,16,0,0,16,0,16,0,0,16,16,0,0,0,16,16,0,0,0,0,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,0,0,0,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,0,0,0,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},}",
- MAP02 = "{{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,0,0,16,0,0,16,0,0,0,16,0,0,16,0,0,0,16,0,16,0,0,0,0,16,0,0,16,16,0,16,16,0,0,0,16,0,0,0,16,16,0,0,0,16,16,16,0,0,0,16,},{16,0,0,16,0,0,16,0,0,0,0,16,16,0,0,0,0,16,0,16,0,0,0,0,16,0,0,16,0,16,0,16,0,0,16,0,16,0,0,16,16,0,0,0,16,16,0,0,0,0,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,0,0,0,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,0,0,0,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},}",
- },
- }
- local function makeFile(_path, _content)
- local file = fs.open(_path, "w")
- _content = _content:gsub("!@".."#&", "%\n")
- --_content = textutils.unserialize(_content)
- file.write(_content) file.close()
- end
- local function makeFolder(_path, _content)
- fs.makeDir(_path)
- for k,v in pairs(_content) do
- if type(v) == "table" then
- makeFolder(_path .. "/" .. k, v)
- else
- makeFile(_path .. "/" .. k, v)
- end
- end
- end
- local sDest = shell.resolve( "Install" ) or "/"
- if sDest == "root" then sDest = "/" end
- local tPackage = pkg
- --makeFolder(sDest, tPackage)
- sbc = term.setBackgroundColor
- stc = term.setTextColor
- scp = term.setCursorPos
- cl = term.clearLine
- doExit = false
- w,h = term.getSize()
- function setup()
- sbc(colors.black)
- term.clear()
- scp(1,1)
- sbc(colors.lightGray)
- cl()
- stc(colors.gray)
- write(string.rep("@",w))
- paintutils.drawFilledBox((w/2) - 15, (h/2) - 5, (w/2) + 15, (h/2) + 8, colors.lightGray )
- paintutils.drawLine((w/2) - 15, (h/2) - 5, (w/2) + 15, (h/2) - 5, colors.gray)
- scp((w/2) - 9, (h/2) - 5)
- stc(colors.white)
- write("The Legend Of Kone")
- end
- function install()
- setup()
- sbc(colors.lightGray)
- scp((w/2) - 15, (h/2) - 3)
- print("Extracting files to path....")
- makeFolder(shell.resolve(path), tPackage)
- sbc(colors.lightGray)
- scp((w/2) - 15, (h/2) - 3)
- print("Files successfully extracted!")
- scp((w/2) - 15, (h/2) - 2)
- print("To launch game run: ")
- scp((w/2) - 12, (h/2) - 1 )
- print(path .. "/launch")
- scp((w/2) - 11, (h/2) + 4 )
- inMenu = true
- opt = {"Launch Game","Exit Installer"}
- selid = 1
- function drawmenu()
- for i=1, #opt do
- scp((w/2) - 11, (h/2) + (3 + i) )
- if(selid == i)then
- write("[ " .. opt[i] .. " ]")
- else
- write(" " .. opt[i] .. " ")
- end
- end
- end
- function updatemenu(ev)
- if(ev[1] == "key")then
- if(ev[2] == keys.up and selid > 1)then
- selid = selid - 1
- drawmenu()
- end
- if(ev[2] == keys.down and selid < #opt)then
- selid = selid + 1
- drawmenu()
- end
- if(ev[2] == keys.enter)then
- return selid
- end
- end
- end
- drawmenu()
- while inMenu and not doExit do
- ev = {os.pullEvent()}
- sel = updatemenu(ev)
- if(sel==1)then
- inMenu = false
- sbc(colors.black)
- stc(colors.white)
- term.clear()
- scp(1,1)
- shell.run(path .."/launch")
- break
- elseif(sel==2 or doExit)then
- inMenu = false
- sbc(colors.black)
- stc(colors.white)
- term.clear()
- scp(1,1)
- break
- end
- end
- end
- function doInstall()
- setup()
- sbc(colors.lightGray)
- scp((w/2) - 11, (h/2) - 3)
- print("Install to: " .. path .. "?")
- scp((w/2) - 11, (h/2) - 1)
- print("Game size: 58.2KB")
- scp((w/2) - 14, (h/2) )
- print("Space free: " .. fs.getFreeSpace("/") .. " bytes.")
- inMenu = true
- opt = {"Yes","No"}
- selid = 2
- function drawmenu()
- for i=1, #opt do
- scp((w/2) - 11, (h/2) + (3 + i) )
- if(selid == i)then
- write("[ " .. opt[i] .. " ]")
- else
- write(" " .. opt[i] .. " ")
- end
- end
- end
- function updatemenu(ev)
- if(ev[1] == "key")then
- if(ev[2] == keys.up and selid > 1)then
- selid = selid - 1
- drawmenu()
- end
- if(ev[2] == keys.down and selid < #opt)then
- selid = selid + 1
- drawmenu()
- end
- if(ev[2] == keys.enter)then
- return selid
- end
- end
- end
- drawmenu()
- while inMenu do
- ev = {os.pullEvent()}
- sel = updatemenu(ev)
- if(sel==1)then
- inMenu = false
- install()
- doExit = true
- break
- elseif(sel==2)then
- inMenu = false
- getPath()
- doExit = true
- break
- elseif(sel==3)then
- inMenu = false
- sbc(colors.black)
- stc(colors.white)
- term.clear()
- scp(1,1)
- doExit = true
- break
- end
- end
- end
- function getPath()
- setup()
- sbc(colors.lightGray)
- scp((w/2) - 11, (h/2) - 3)
- print("Enter an install path.")
- scp((w/2) - 12, (h/2) - 1)
- sbc(colors.gray)
- write(string.rep(" ",24))
- sbc(colors.lightGray)
- scp((w/2) - 12, (h/2) - 1)
- sbc(colors.gray)
- if(not doExit)then path = read() end
- sbc(colors.lightGray)
- inMenu = false
- opt = {"Yes","No"}
- selid = 1
- if(not fs.isDir(path))then
- inMenu = true
- scp((w/2) - 15, (h/2) + 2)
- print("No such directory, create it?")
- function drawmenu()
- for i=1, #opt do
- scp((w/2) - 11, (h/2) + (3 + i) )
- if(selid == i)then
- write("[ " .. opt[i] .. " ]")
- else
- write(" " .. opt[i] .. " ")
- end
- end
- end
- function updatemenu(ev)
- if(ev[1] == "key")then
- if(ev[2] == keys.up and selid > 1)then
- selid = selid - 1
- drawmenu()
- end
- if(ev[2] == keys.down and selid < #opt)then
- selid = selid + 1
- drawmenu()
- end
- if(ev[2] == keys.enter)then
- return selid
- end
- end
- end
- drawmenu()
- while inMenu and not doExit do
- ev = {os.pullEvent()}
- sel = updatemenu(ev)
- if(sel==1)then
- inMenu = false
- fs.makeDir(path)
- doInstall()
- break
- elseif(sel==2)then
- inMenu = false
- getPath()
- break
- elseif(sel==3)then
- inMenu = false
- sbc(colors.black)
- stc(colors.white)
- term.clear()
- scp(1,1)
- break
- end
- end
- getPath()
- end
- scp((w/2) - 11, (h/2) + 1 )
- print("Press Any Key")
- os.pullEvent("key")
- doInstall()
- end
- getPath()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement