|
Post by Tag365 on Feb 9, 2015 23:51:53 GMT
{"makeStub.lua":"print('Generating Installer Stubs!')\nlocal FileTable = {}\n\nfunction requireFromRoot(File)\n local Handle, err = io.open(\"..\/\"..File..\".lua\")\n local String, Funct = \"\", nil\n if Handle then\n String = \"require = requireFromRoot\\n\"..Handle:read(\"*a\")\n Handle:close()\n Funct = load(String)\n end\n --local Funct, err = loadfile(\"..\"..File..\".lua\")\n if Funct then\n local var1 = Funct()\n require = Require\n return var1 or true\n else\n print(err)\n end\nend\n\nlfs = require \"lfs\"\n\nJSON = require(\"JSON\")\nlocal files = sys.dir()\n\nfunction lfs.isDirectory(Path)\n return lfs.attributes(Path, \"mode\") == \"directory\"\nend\n\nfor k, v in ipairs(files) do\n if v ~= \".\" and v ~= \"..\" and v ~= \"InstallStub\" and v~= \"SavedData\" then\n if lfs.isDirectory(v) then\n local sub = sys.dir(v)\n for k2, v2 in ipairs(sub) do\n if v2 ~= \".\" and v2 ~= \"..\" and string.sub(v, -8)~=\"stub.lua\" and not v2:find(\".png\") then\n files[#files + 1] = v..\"\/\"..v2\n end\n end\n end\n end\nend\n\nfor k, v in ipairs(files) do\n if v ~= \".\" and v ~= \"..\" and string.sub(v, -8)~=\"stub.lua\" then\n local file = io.open(v)\n if file then\n FileTable[v] = file:read(\"*a\")\n file:close()\n end\n end\nend\n\n\nlocal String = JSON.EncodeJSON(FileTable)\nprint(#String..\" bytes\")\n\nif not lfs.isDirectory(\"InstallStub\") then\n lfs.mkdir(\"InstallStub\")\nend\n\nprint(\"Saving...\")\nlocal Chunk = 8192*16\nfor i=1, math.ceil(#String\/Chunk) do\n file = io.open(\"InstallStub\/TouchLuaBuilder\".. i..\"stub.lua\", \"w\")\n file:write(string.sub(String, ((i - 1)*Chunk) + 1, math.min(i*Chunk, #String)))\n file:close()\nend\nprint(\"Done!\")","stages3.lua":"if not game then require \"main\" end\nlocal t, f = true, false\n\n-- Stage 21\nstages[21] = {[\"bonus\"] = 8}\nstages[21].commands = {t, t, t, t, f, f, f, t,f}\nstages[21].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[21].cubot1x = 10\nstages[21].cubot1y = 3\nstages[21].door1x = 15\nstages[21].door1y = 7\n\n-- Stage 22\nstages[22] = {[\"bonus\"] = 10}\nstages[22].commands = {t, t, t, t, f, f, t, t,f}\nstages[22].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[22].cubot1x = 15\nstages[22].cubot1y = 3\nstages[22].door1x = 15\nstages[22].door1y = 3\nstages[22].key1x = 9\nstages[22].key1y = 3\n\n-- Stage 23\nstages[23] = {[\"bonus\"] = 10}\nstages[23].commands = {t, t, t, t, t, t, t, t,f}\nstages[23].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[23].cubot1x = 10\nstages[23].cubot1y = 8\nstages[23].door1x = 15\nstages[23].door1y = 2\n\n-- Stage 24\nstages[24] = {[\"bonus\"] = 13}\nstages[24].commands = {t, t, t, t, t, t, t, t,f}\nstages[24].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[24].cubot1x = 12\nstages[24].cubot1y = 4\nstages[24].door1x = 14\nstages[24].door1y = 2\nstages[24].key1x = 16\nstages[24].key1y = 4\n\n-- Stage 25\nstages[25] = {[\"bonus\"] = 12}\nstages[25].commands = {t, t, t, t, t, t, t, t,f}\nstages[25].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[25].cubot1x = 16\nstages[25].cubot1y = 2\nstages[25].door1x = 11\nstages[25].door1y = 8\n\n-- Stage 26\nstages[26] = {[\"bonus\"] = 11}\nstages[26].commands = {t, t, t, t, t, t, t, t,f}\nstages[26].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[26].cubot1x = 14\nstages[26].cubot1y = 2\nstages[26].door1x = 16\nstages[26].door1y = 6\n\n-- Stage 27\nstages[27] = {[\"bonus\"] = 15}\nstages[27].commands = {t, t, t, t, t, t, t, t,f}\nstages[27].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[27].cubot1x = 14\nstages[27].cubot1y = 2\nstages[27].door1x = 15\nstages[27].door1y = 2\n\n-- Stage 28\nstages[28] = {[\"bonus\"] = 13}\nstages[28].commands = {t, t, t, t, t, t, t, t,f}\nstages[28].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[28].cubot1x = 14\nstages[28].cubot1y = 6\nstages[28].door1x = 13\nstages[28].door1y = 6\nstages[28].key1x = 14\nstages[28].key1y = 2\n\n-- Stage 31\nstages[31] = {[\"bonus\"] = 14}\nstages[31].commands = {t, t, t, t, f, f, t, t,f}\nstages[31].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[31].cubot1x = 10\nstages[31].cubot1y = 3\nstages[31].door1x = 10\nstages[31].door1y = 3\nstages[31].key1x = 16\nstages[31].key1y = 3\nstages[31].cubot2x = 10\nstages[31].cubot2y = 6\nstages[31].door2x = 10\nstages[31].door2y = 6\nstages[31].key2x = 16\nstages[31].key2y = 6\n\n-- Stage 32\nstages[32] = {[\"bonus\"] = 22}\nstages[32].commands = {t, t, t, t, t, t, t, t,f}\nstages[32].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[32].cubot1x = 12\nstages[32].cubot1y = 8\nstages[32].door1x = 10\nstages[32].door1y = 7\nstages[32].key1x = 16\nstages[32].key1y = 7\nstages[32].cubot2x = 14\nstages[32].cubot2y = 4\nstages[32].door2x = 16\nstages[32].door2y = 3\nstages[32].key2x = 10\nstages[32].key2y = 3\n\n-- Stage 33\nstages[33] = {[\"bonus\"] = 10}\nstages[33].commands = {t, t, t, t, f, f, t, t,f}\nstages[33].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[33].cubot1x = 9\nstages[33].cubot1y = 2\nstages[33].door1x = 12\nstages[33].door1y = 8\nstages[33].cubot2x = 17\nstages[33].cubot2y = 2\nstages[33].door2x = 14\nstages[33].door2y = 8\n\n-- Stage 34\nstages[34] = {[\"bonus\"] = 22}\nstages[34].commands = {t, t, t, t, t, t, t, t,f}\nstages[34].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[34].cubot1x = 14\nstages[34].cubot1y = 7\nstages[34].door1x = 15\nstages[34].door1y = 5\nstages[34].cubot2x = 14\nstages[34].cubot2y = 2\nstages[34].door2x = 14\nstages[34].door2y = 2\n\n-- Stage 35\nstages[35] = {[\"bonus\"] = 19}\nstages[35].commands = {t, t, t, t, t, t, t, t,f}\nstages[35].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,1,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[35].cubot1x = 16\nstages[35].cubot1y = 5\nstages[35].door1x = 14\nstages[35].door1y = 5\nstages[35].cubot2x = 16\nstages[35].cubot2y = 3\nstages[35].door2x = 12\nstages[35].door2y = 5\n\n-- Stage 36\nstages[36] = {[\"bonus\"] = 23}\nstages[36].commands = {t, t, t, t, t, t, t, t,f}\nstages[36].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,1,0,2,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,1,0,1,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,1,0,1,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[36].cubot1x = 12\nstages[36].cubot1y = 5\nstages[36].door1x = 16\nstages[36].door1y = 5\nstages[36].cubot2x = 12\nstages[36].cubot2y = 8\nstages[36].door2x = 16\nstages[36].door2y = 8\n\n-- Stage 37\nstages[37] = {[\"bonus\"] = 23}\nstages[37].commands = {t, t, t, t, t, t, t, t,f}\nstages[37].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,2,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[37].cubot1x = 9\nstages[37].cubot1y = 5\nstages[37].door1x = 10\nstages[37].door1y = 7\nstages[37].cubot2x = 13\nstages[37].cubot2y = 8\nstages[37].door2x = 13\nstages[37].door2y = 5\n\n-- Stage 38\nstages[38] = {[\"bonus\"] = 23}\nstages[38].commands = {t, t, t, t, t, t, t, t,f}\nstages[38].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,2,0,0,2,0,0,2,0,0},\n {0,0,0,0,0,0,0,1,2,1,1,1,1,1,2,1,0},\n {0,0,0,0,0,0,0,1,2,1,0,0,0,1,2,1,0},\n {0,0,0,0,0,0,0,1,2,0,0,0,0,0,2,1,0},\n {0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,1,0,2,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[38].cubot1x = 12\nstages[38].cubot1y = 7\nstages[38].door1x = 12\nstages[38].door1y = 7\nstages[38].cubot2x = 8\nstages[38].cubot2y = 3\nstages[38].door2x = 14\nstages[38].door2y = 3","LuaApp.lua":"-- This is a script used for Lua App Manager.\nCubots March!\nCubots March!\nThose forgetful cubots went and forgot their code again! Only you can help them acomplish their tasks and give their lives a sense of fulfillment.\nVersion 0.7\nAuthor\nmain\nicon.png","touchx.lua":"if not game then require \"main\" end\n---------------------\n-- Touch Functions --\n---------------------\n\n-- Checks if point is in rectangle\nfunction touch.rect(px, py, rx1, ry1, rx2, ry2)\n rx1, rx2 = math.min(rx1, rx2), math.max(rx1, rx2)\n ry1, ry2 = math.min(ry1, ry2), math.max(ry1, ry2)\n if px > rx1 and px < rx2 then\n if py > ry1 and py < ry2 then\n return true\n end\n end\n return false\nend\n\n-- This function exists because Touch Lua does not accept nil variables for draw.tracktouches\nfunction none() end\n\n-- Gameplay touch events\nfunction touch.beganGameplay(tx, ty)\n -- Are the cubots executing commands? If not, then continue.\n if not playing then\n -- If player tapped on a command in the command list, then select the command that the player tapped on.\n if ty < 48 then\n if math.floor(tx\/36) < 1 then\n selectedcommand = 0 -- Clear Cmd\n elseif math.floor(tx\/36) < 10 then\n -- Is the command available?\n if availcommands[math.floor(tx\/36)] then\n -- The user has selected this command.\n selectedcommand = math.floor(tx\/36)\n debugPrint(\"Player selected command \"..selectedcommand)\n end\n end\n end\n end\n if tx > ScreenX - 48 and ty < 48 then\n playing = not playing\n if playing then\n sounds.startExecution()\n else\n sounds.stopExecution()\n end\n game.resetStage()\n end\nend\n\nfunction touch.movedGameplay(tx, ty)\n -- The commands list does not show commands if the cubots are executing commands.\n if not playing then\n -- Show the command that the player is draging.\n dragx, dragy = tx, ty\n end\nend\n\nfunction touch.endedGameplay(tx, ty)\n -- Are the cubots executing commands? If not, then switch a command on the cubot with the one that they just placed.\n if not playing and ty > 48 then\n if math.floor(tx\/36) + 1 <= maxcommands then\n if ty < 96 then\n -- Add a command to Cubot 1\n cubot1[math.floor(tx\/36) + 1] = selectedcommand\n elseif ty < 128 and cubot2x then\n -- Add a command to Cubot 2\n cubot2[math.floor(tx\/36) + 1] = selectedcommand\n elseif ty < 160 and availcommands[8] then\n -- Add a command to Function 1\n funct1[math.floor(tx\/36) + 1] = selectedcommand\n elseif ty < 192 and availcommands[9] then\n -- Add a command to Function 2\n funct2[math.floor(tx\/36) + 1] = selectedcommand\n end\n end\n end\n -- Have they tapped the hide coding button?\n if tx > ScreenX - 48 and ty > 48 and ty < 96 then\n -- Hide or show the code!\n hidecoding = not hidecoding\n elseif tx > ScreenX - 48 and ty > 96 and ty < 96 + 48 then\n levelexit = true\n end\n dragx, dragy = nil, nil\nend\n\n-- Levels Menu touch events\nfunction touch.beganLevels()\nend\n\nfunction touch.movedLevels()\nend\n\nfunction touch.endedLevels(tx, ty)\n -- Have they tapped a button?\n if tx < 48 and ty < 48 then\n set = math.max(set - 1, 1)\n elseif tx > ScreenX - 48 and ty < 48 then\n set = math.min(set + 1, 5)\n elseif tx > ScreenX - 48 and ty > ScreenY - 48 then\n back = true\n end\n local levx, levy = math.floor((tx - ((ScreenX - 480)*.5))\/64), math.floor(ty\/64)\n -- Which row of levels have they tapped?\n if levy == 1 then\n selectedlevel = levx + (set - 1)*10\n if selectedlevel > (set - 1)*10 + 5 then\n selectedlevel = nil\n end\n elseif levy == 2 then\n selectedlevel = levx + 5 + (set - 1)*10\n if selectedlevel > set*10 then\n selectedlevel = nil\n end\n end\n -- Does the stage selected even exist?\n if not stages[selectedlevel] then\n selectedlevel = nil\n end\nend\n\n-- Help Menu touch events\nfunction touch.endedHelp(tx, ty)\n if ty > ScreenY - 48 then\n if tx > ScreenX - 48 then\n nextPage = true\n elseif tx > ScreenX - 96 then\n back = true\n end\n end\nend\n\n-- Main Menu touch events\nfunction touch.beganMenu()\nend\n\nfunction touch.movedMenu()\nend\n\nfunction touch.endedMenu(tx, ty)\n Play = touch.rect(tx, ty, 128, 140, ScreenX, 140 + 64)\n Help = touch.rect(tx, ty, 128 + 48, 204, ScreenX, 204 + 64)\n Sound = touch.rect(tx, ty, 128 + 96, 268, ScreenX, 268 + 64)\n Corrupt = tx - ty < -96\nend","sounds.lua":"if not game then require \"main\" end\nsounds = {}\nsounds.genBuffer = {}\nsounds.genCoroutines = {}\nsounds.buffers = {}\nfunction sounds.genBuffer.static(str)\n local buffer = {}\n buffer.rate = 44100\n buffer.channels = 2\n buffer.bits = 16\n buffer.data = {}\n\n time = 5\n frequency = 400\n amplitude = 10000\n slice = 1 \/ buffer.rate\n count = buffer.rate * time\n\n for i = 1, count do\n t = (i-1) * slice\n v = amplitude * math.sin( 2 * math.pi * frequency * t )*(math.random()*((i\/count)*.1) + (.9 - (i\/count)))\n table.insert(buffer.data, v)\n if buffer.channels == 2 then\n table.insert(buffer.data, v)\n end\n if math.floor(i\/100000) == i\/100000 then\n coroutine.yield(\"Yielding\")\n end\n end\n sounds.buffers[str] = buffer\n return true\nend\n\ncurTimer = game.time() + 1\n\nfunction sounds.continueCoroutines()\n local deadCoroutines = {}\n for k, v in pairs(sounds.genCoroutines) do\n if coroutine.status(v) ~= \"dead\" then\n local l, newBuffer = coroutine.resume(v, k)\n if newBuffer == true then\n print(\"Done Loading Buffer \"..k)\n sounds.playSound(k)\n deadCoroutines[#deadCoroutines + 1] = k\n elseif newBuffer ~= \"Yielding\" then\n error(newBuffer)\n end\n else\n deadCoroutines[#deadCoroutines + 1] = k\n end\n end\n for k, v in ipairs(deadCoroutines) do\n sounds.genCoroutines[v] = nil\n end\nend\n\nfunction sounds.load(sound)\n if sounds.genBuffer[sound] then\n sounds.genCoroutines[sound] = coroutine.create(sounds.genBuffer[sound])\n end\nend\n\nfunction sounds.playSound(str)\n if sounds.buffers[str] then\n print(\"Sound \"..str)\n audio.playbuffer(sounds.buffers[str], 1, 1, 0)\n else\n sounds.load(str)\n end\nend\n\nfunction sounds.static()\n if isAudioEnabled then\n sounds.playSound(\"static\")\n else\n sys.alert(\"tock\")\n end\nend\n\nfunction sounds.startExecution()\n if isAudioEnabled then\n sounds.playSound(\"startExecution\")\n else\n sys.alert(\"tock\")\n end\nend\n\nfunction sounds.stopExecution()\n if isAudioEnabled then\n sounds.playSound(\"stopExecution\")\n else\n sys.alert(\"tock\")\n end\nend\n\nfunction sounds.ding()\n if isAudioEnabled then\n sounds.playSound(\"ding\")\n else\n sys.alert(\"tock\")\n end\nend\n\nfunction sounds.win()\n if isAudioEnabled then\n sounds.playSound(\"win\")\n else\n sys.alert(\"tick\")\n end\nend","stages5.lua":"if not game then require \"main\" end\nlocal t, f = true, false\n\n-- Stage 41\nstages[41] = {[\"bonus\"] = 12}\nstages[41].commands = {t, t, t, t, t, t, t, t,t}\nstages[41].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[41].cubot1x = 9\nstages[41].cubot1y = 1\nstages[41].door1x = 10\nstages[41].door1y = 9\n\n-- Stage 42\nstages[42] = {[\"bonus\"] = 21}\nstages[42].commands = {t, t, t, t, t, t, t, t,t}\nstages[42].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,1,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0},\n}\nstages[42].cubot1x = 12\nstages[42].cubot1y = 9\nstages[42].door1x = 11\nstages[42].door1y = 8\nstages[42].key1x = 11\nstages[42].key1y = 1\n\n-- Stage 43\nstages[43] = {[\"bonus\"] = 18}\nstages[43].commands = {t, t, t, t, t, t, t, t,t}\nstages[43].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[43].cubot1x = 10\nstages[43].cubot1y = 3\nstages[43].door1x = 15\nstages[43].door1y = 9\n\n-- Stage 44\nstages[44] = {[\"bonus\"] = 16}\nstages[44].commands = {t, t, t, t, t, t, t, t,t}\nstages[44].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0},\n {0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,0},\n {0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[44].cubot1x = 12\nstages[44].cubot1y = 5\nstages[44].door1x = 8\nstages[44].door1y = 4\n\n-- Stage 45\nstages[45] = {[\"bonus\"] = 19}\nstages[45].commands = {t, t, t, t, t, t, t, t,t}\nstages[45].data = {\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0},\n {0,0,0,0,0,0,0,1,0,2,0,0,0,2,0,1,0},\n {0,0,0,0,0,0,0,1,0,1,0,2,0,1,0,1,0},\n {0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0},\n {0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0},\n {0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0},\n}\nstages[45].cubot1x = 12\nstages[45].cubot1y = 3\nstages[45].door1x = 16\nstages[45].door1y = 7\n\n-- Stage 46\nstages[46] = {[\"bonus\"] = 23}\nstages[46].commands = {t, t, t, t, t, t, t, t,t}\nstages[46].data = {\n {0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n}\nstages[46].cubot1x = 12\nstages[46].cubot1y = 2\nstages[46].door1x = 12\nstages[46].door1y = 10\n\n-- Stage 47\nstages[47] = {[\"bonus\"] = 23}\nstages[47].commands = {t, t, t, t, t, t, t, t,t}\nstages[47].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0},\n {0,0,0,0,0,0,0,1,1,1,0,0,2,1,1,1,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0},\n {0,0,0,0,0,0,0,0,1,0,0,0,2,0,1,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[47].cubot1x = 12\nstages[47].cubot1y = 6\nstages[47].door1x = 14\nstages[47].door1y = 2\nstages[47].key1x = 8\nstages[47].key1y = 3\n\n-- Stage 48\nstages[48] = {[\"bonus\"] = 18}\nstages[48].commands = {t, t, t, t, t, t, t, t,t}\nstages[48].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0},\n}\nstages[48].cubot1x = 14\nstages[48].cubot1y = 1\nstages[48].door1x = 9\nstages[48].door1y = 1","stages.lua":"if not game then require \"main\" end\n------------------\n-- Level Tables --\n------------------\nstages = {}\nlocal t, f = true, false\n-- Stage 1\nstages[1] = {[\"bonus\"] = 4}\nstages[1].commands = {t, t, f, f, f, f, f, f,f}\nstages[1].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[1].cubot1x = 10\nstages[1].cubot1y = 2\nstages[1].door1x = 14\nstages[1].door1y = 5\n\n-- Stage 2\nstages[2] = {[\"bonus\"] = 4}\nstages[2].commands = {t, t, f, f, f, f, f, f,f}\nstages[2].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[2].cubot1x = 13\nstages[2].cubot1y = 3\nstages[2].door1x = 13\nstages[2].door1y = 6\n\n-- Stage 3\nstages[3] = {[\"bonus\"] = 5}\nstages[3].commands = {t, t, f, f, f, f, t, f,f}\nstages[3].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[3].cubot1x = 10\nstages[3].cubot1y = 4\nstages[3].door1x = 15\nstages[3].door1y = 2\n\n-- Stage 4\nstages[4] = {[\"bonus\"] = 8}\nstages[4].commands = {t, t, f, f, f, f, t, f,f}\nstages[4].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[4].cubot1x = 14\nstages[4].cubot1y = 3\nstages[4].door1x = 14\nstages[4].door1y = 5\n\n-- Stage 5\nstages[5] = {[\"bonus\"] = 8}\nstages[5].commands = {t, t, f, f, t, f, t, f,f}\nstages[5].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[5].cubot1x = 14\nstages[5].cubot1y = 4\nstages[5].door1x = 15\nstages[5].door1y = 2\n\n-- Stage 6\nstages[6] = {[\"bonus\"] = 6}\nstages[6].commands = {t, t, f, f, f, t, t, f,f}\nstages[6].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[6].cubot1x = 14\nstages[6].cubot1y = 4\nstages[6].door1x = 12\nstages[6].door1y = 2\n\n-- Stage 7\nstages[7] = {[\"bonus\"] = 8}\nstages[7].commands = {t, t, f, f, t, t, t, f,f}\nstages[7].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[7].cubot1x = 12\nstages[7].cubot1y = 2\nstages[7].door1x = 14\nstages[7].door1y = 2\n\n-- Stage 8\nstages[8] = {[\"bonus\"] = 7}\nstages[8].commands = {t, t, f, f, t, t, t, f,f}\nstages[8].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[8].cubot1x = 14\nstages[8].cubot1y = 3\nstages[8].door1x = 13\nstages[8].door1y = 2\nstages[8].key1x = 11\nstages[8].key1y = 2\n\n--[[-- Stage 9\nstages[9] = {[\"bonus\"] = 8}\nstages[9].commands = {t, t, f, f, t, t, t, f,f}\nstages[9].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[9].cubot1x = 13\nstages[9].cubot1y = 4\nstages[9].door1x = 13\nstages[9].door1y = 6]]\n\n-- Stage 11\nstages[11] = {[\"bonus\"] = 7}\nstages[11].commands = {t, t, f, f, t, t, t, f,f}\nstages[11].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[11].cubot1x = 12\nstages[11].cubot1y = 3\nstages[11].door1x = 11\nstages[11].door1y = 2\n\n-- Stage 12\nstages[12] = {[\"bonus\"] = 8}\nstages[12].commands = {t, t, f, f, t, t, t, f,f}\nstages[12].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[12].cubot1x = 11\nstages[12].cubot1y = 5\nstages[12].door1x = 15\nstages[12].door1y = 3\n\n-- Stage 13\nstages[13] = {[\"bonus\"] = 7}\nstages[13].commands = {t, t, f, f, t, t, t, f,f}\nstages[13].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[13].cubot1x = 12\nstages[13].cubot1y = 2\nstages[13].door1x = 12\nstages[13].door1y = 5\n\n-- Stage 14\nstages[14] = {[\"bonus\"] = 7}\nstages[14].commands = {t, t, f, f, t, t, t, f,f}\nstages[14].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[14].cubot1x = 13\nstages[14].cubot1y = 3\nstages[14].door1x = 11\nstages[14].door1y = 2\n\n-- Stage 15\nstages[15] = {[\"bonus\"] = 8}\nstages[15].commands = {t, t, f, f, t, t, t, f,f}\nstages[15].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[15].cubot1x = 12\nstages[15].cubot1y = 3\nstages[15].door1x = 12\nstages[15].door1y = 5\n\n-- Stage 16\nstages[16] = {[\"bonus\"] = 8}\nstages[16].commands = {t, t, f, f, t, t, t, f,f}\nstages[16].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[16].cubot1x = 10\nstages[16].cubot1y = 6\nstages[16].door1x = 14\nstages[16].door1y = 2\n\n-- Stage 17\nstages[17] = {[\"bonus\"] = 5}\nstages[17].commands = {t, t, f, f, t, t, t, f,f}\nstages[17].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,2,2,0,0,0,2,2,0,0},\n {0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[17].cubot1x = 12\nstages[17].cubot1y = 4\nstages[17].door1x = 9\nstages[17].door1y = 4\n\n-- Stage 18\nstages[18] = {[\"bonus\"] = 8}\nstages[18].commands = {t, t, f, f, t, t, t, f,f}\nstages[18].data = {\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\nstages[18].cubot1x = 13\nstages[18].cubot1y = 3\nstages[18].door1x = 15\nstages[18].door1y = 1","save.data":"2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n","main.lua":"sys.clear()\ndraw.setscreen(1)\ndraw.clear(draw.black)\ndraw.settitle(\"Cubots March!\")\napproot = approot or \"\"\ntouch = {}\ngame = {}\nsave = {[\"data\"] = {}}\nScreenX, ScreenY = draw.getport()\ndraw.setantialias(false)\n\n-- Generate Resources\nrequire \"lfs\"\nfunction lfs.isDirectory(Path)\n return lfs.attributes(Path, \"mode\") == \"directory\"\nend\nif not lfs.isDirectory(approot..\"resources\") then\n require(approot..\"ResourceGenerator\")\nend\n\n-- Some basic gameplay variables\nisAudioEnabled = false\nblocksize = 36\nblfulldepth = 56\nmaxcommands = 8\nstagewidth = 16\nstageheight = 10\ndrawx, drawy = ScreenX - stagewidth*(blocksize + 3), ScreenY - stageheight*blocksize\ntimeperstep = 2\ntimetonextstep = timeperstep\ntimestepstart = 0\ntimestep = 0\nselectedcommand = 0\nstage = {}\nstagepaused = {}\nhidecoding = false\ncubot1 = {0, 0, 0, 0, 0, 0, 0, 0}\ncubot2 = {0, 0, 0, 0, 0, 0, 0, 0}\nfunct1 = {0, 0, 0, 0, 0, 0, 0, 0}\nfunct2 = {0, 0, 0, 0, 0, 0, 0, 0}\ncubot1dir, cubot2dir = 0, 0 -- Current direction each Cubot is facing.\ncurcubot1 = 0 -- Curent command Cubot 1 is running.\ncurcubot2 = 0\ncurfunct1c1 = 0 -- Curent command in function 1 Cubot 1 is running\ncurfunct1c2 = 0\ncurfunct2c1 = 0\ncurfunct2c2 = 0\ncubot1x, cubot1y = 0, 0 -- Cubot 1's position.\ncubot2x, cubot2y = 0, 0\ncubot1dx, cubot1dy = 0, 0\ncubot2dx, cubot2dy = 0, 0\n\nfunction assert(value, message, errlevel)\n message = message or \"assertion failed!\"\n if not value then\n error(message, errlevel)\n end\nend\n\nfunction debugPrint(...)\n if debugMode then\n print(...)\n end\nend\n\n--------------------\n-- Save Functions --\n--------------------\n\n-- Save unsaved changes to save file.\nfunction save.updateSave(hideSaveIndicator)\n if not hideSaveIndicator then\n -- Show saving indicator.\n for i=1, 1 do\n draw.beginframe()\n draw.fillrect(0, ScreenY - 48, 48*3, ScreenY, draw.black)\n draw.fillrect(0, ScreenY - 48, 48, ScreenY, draw.white)\n draw.endframe()\n sys.sleep(100)\n draw.beginframe()\n draw.fillrect(0, ScreenY - 48, 48*3, ScreenY, draw.black)\n draw.fillrect(48, ScreenY - 48, 96, ScreenY, draw.white)\n draw.endframe()\n sys.sleep(100)\n draw.beginframe()\n draw.fillrect(0, ScreenY - 48, 128, ScreenY, draw.black)\n draw.fillrect(96, ScreenY - 48, 48*3, ScreenY, draw.white)\n draw.endframe()\n sys.sleep(100)\n end\n end\n -- Save to the file.\n if not isCorrupted then\n local file = io.open(approot..\"save.data\", \"w\")\n for k, v in ipairs(save.data) do\n file:write(tostring(v)..\"\\n\")\n end\n file:close()\n end\nend\n\n-- Generate a new save file.\nfunction save.newData()\n -- Generate default values for save data.\n for i=1, 50 do\n save.data = 0\n end\n save.updateSave(true)\nend\n\n-- Reload saved data.\nfunction save.loadData()\n local file = io.open(approot..\"save.data\")\n if file then\n file:close()\n for line in io.lines(approot..\"save.data\") do\n save.data[#save.data + 1] = math.min(math.max(tonumber(line) or 0, 0), 2)\n end\n else -- Save data is not present\n save.newData()\n end\nend\n\nsave.loadData() -- Time to load data!\n\n-- Function used for time\ngame.time = os.clock\n\nrequire \"drawx\"\nrequire \"touchx\"\nrequire \"stages\"\nrequire \"stages3\"\nrequire \"stages5\"\nrequire \"sounds\"\n\n--------------------\n-- Game Functions --\n--------------------\n\n-- Resets the stage to paused position\nfunction game.resetStage()\n -- Rebuild stage from original state\n stage = {}\n for k, v in ipairs(stagepaused) do\n stage[k] = {}\n for k2, v2 in ipairs(v) do\n stage[k][k2] = v2\n end\n end\n curblock1x, curblock1y = nil, nil\n oldblock1x, oldblock1y = nil, nil\n newblock1x, newblock1y = nil, nil\n curblock2x, curblock2y = nil, nil\n oldblock2x, oldblock2y = nil, nil\n newblock2x, newblock2y = nil, nil\n curcubot1 = 0\n curcubot2 = 0\n curfunct1c1 = 0\n curfunct1c2 = 0\n curfunct2c1 = 0\n curfunct2c2 = 0\n cubot1x, cubot1y = cubot1xold, cubot1yold\n cubot1dx, cubot1dy = cubot1x, cubot1y\n --- Reset variables\n moving1 = nil\n curblock1x, curblock1y = nil, nil\n oldblock1x, oldblock1y = nil, nil\n newblock1x, newblock1y = nil, nil\n if key1x then\n door1locked = true\n end\n if cubot2y then\n cubot2x, cubot2y = cubot2xold, cubot2yold\n cubot2dx, cubot2dy = cubot2x, cubot2y\n else\n cubot2x, cubot2y = nil, nil\n cubot2dx, cubot2dy = nil, nil\n door2x, door2y = nil, nil\n end\nend\n\n-- Loads and prepares stage for gameplay.\nfunction game.prepareStage()\n -- Reset variables\n levelexit = false\n selectedcommand = 0\n cubot1 = {0, 0, 0, 0, 0, 0, 0, 0}\n cubot2 = {0, 0, 0, 0, 0, 0, 0, 0}\n funct1 = {0, 0, 0, 0, 0, 0, 0, 0}\n funct2 = {0, 0, 0, 0, 0, 0, 0, 0}\n curcubot1 = 0\n curcubot2 = 0\n curfunct1c1 = 0\n curfunct1c2 = 0\n curfunct2c1 = 0\n curfunct2c2 = 0\n -- Load the stage\n stage = stages[selectedlevel].data\n stagepaused = {}\n cubot2x, cubot2y = nil, nil\n cubot2dx, cubot2dy = nil, nil\n door2x, door2y = nil, nil\n -- We can't just refrence the table for the version we use to reset when we reset execution, we need to clone it. Otherwise it will be modified in gameplay.\n for k, v in ipairs(stage) do\n stagepaused[k] = {}\n for k2, v2 in ipairs(v) do\n stagepaused[k][k2] = v2\n end\n end\n -- Set other variables.\n bonus = math.floor(stages[selectedlevel].bonus)\n availcommands = stages[selectedlevel].commands\n cubot1x, cubot1y = stages[selectedlevel].cubot1x, stages[selectedlevel].cubot1y\n door1x, door1y = stages[selectedlevel].door1x, stages[selectedlevel].door1y\n cubot1xold, cubot1yold = cubot1x, cubot1y\n cubot1xst, cubot1yst = cubot1x, cubot1y\n cubot1dx, cubot1dy = cubot1x, cubot1y\n -- Do we have a second Cubot?\n if stages[selectedlevel].cubot2y then\n cubot2x, cubot2y = stages[selectedlevel].cubot2x, stages[selectedlevel].cubot2y\n door2x, door2y = stages[selectedlevel].door2x, stages[selectedlevel].door2y\n cubot2xold, cubot2yold = cubot2x, cubot2y\n cubot2xst, cubot2yst = cubot2x, cubot2y\n cubot2dx, cubot2dy = cubot2x, cubot2y\n else\n cubot2x, cubot2y = nil, nil\n door2x, door2y = nil, nil\n end\n -- Is Door 1 supposed to be locked?\n if stages[selectedlevel].key1x then\n door1locked = true\n key1x = stages[selectedlevel].key1x\n key1y = stages[selectedlevel].key1y\n else\n door1locked = nil\n key1x, key1y = nil, nil\n end\n -- Is Door 2 supposed to be locked?\n if stages[selectedlevel].key2x then\n door2locked = true\n key2x = stages[selectedlevel].key2x\n key2y = stages[selectedlevel].key2y\n else\n door2locked = nil\n key2x, key2y = nil, nil\n end\nend\n\nfunction affectMovingBlocks(x, y)\n if not oldblock1x then\n oldblock1x, oldblock1y = x, y\n end\n curblock1x, curblock1y = oldblock1x, oldblock1y\n stage[y][x] = 0\n for k, v in ipairs(stage) do\n if k >= y then\n if v[x] > 0 then -- If solid block\n newblock1x, newblock1y = x, k - 1\n debugPrint(\"Put block at \"..k - 1)\n stage[k - 1][x] = 2\n movedblock = true\n break\n end\n end\n end\nend\n\nfunction checkMovingBlocks(x, y)\n local blocksFalling = 0\n if y > 0 then\n if stage[y][x] == 2 then\n --blocksFalling = 1\n for k=y, 1, -1 do\n if stage[k][x] == 2 then\n blocksFalling = blocksFalling + 1\n else\n break\n end\n end\n end\n if blocksFalling > 0 then\n for k=y, y - (blocksFalling - 1), -1 do\n affectMovingBlocks(x, k)\n end\n end\n end\nend\n\n-- Handle Cubot 1's current command\nfunction game.handleCubot1sub(ctype)\n cubot1x = math.min(cubot1x, #stage[1] - 1)\n if cubot1x < 1 and cubot1y > 10 then\n game.cubotEscaped()\n else -- Handle function\n local movedblock\n oldcubot1x = cubot1x\n if ctype == 1 or (ctype == 3 and cubot1dir < 0) then -- Move Left\n cubot1dir = -1\n if cubot1x < 2 then\n cubot1x, cubot1y = 0, 11\n else\n if not (stage[cubot1y][cubot1x - 1] == 1 or stage[cubot1y][cubot1x - 1] == 2) then\n oldcubot1y = cubot1y\n checkMovingBlocks(cubot1x, cubot1y - 1)\n cubot1x = cubot1x - 1\n fall = true\n if key1x == cubot1x and key1y == oldcubot1y then\n door1locked = false\n end\n for k, v in ipairs(stage) do\n if k > cubot1y then\n if v[cubot1x] == 1 or v[cubot1x] == 2 then -- If solid block\n cubot1y = k - 1\n debugPrint(\"Put Cubot 1 at \"..k - 1)\n fall = false\n break\n end\n end\n end\n if fall then\n debugPrint(\"Put Cubot 1 at floor\")\n cubot1y = 10\n end\n end\n end\n elseif ctype == 2 or ctype == 3 and cubot1dir > 0 then -- Move Right\n cubot1dir = 1\n if cubot1x > 15 then\n cubot1x = 16\n else\n if not (stage[cubot1y][cubot1x + 1] == 1 or stage[cubot1y][cubot1x + 1] == 2) then\n checkMovingBlocks(cubot1x, cubot1y - 1)\n oldcubot1y = cubot1y\n cubot1x = cubot1x + 1\n fall = true\n for k, v in ipairs(stage) do\n if cubot1y < k then\n debugPrint(\"Put block at \"..cubot1x..\", \"..k..\"=\"..v[cubot1x])\n if v[cubot1x] == 1 or v[cubot1x] == 2 then -- If solid block is below Cubot 1\n cubot1y = k - 1\n debugPrint(\"Put Cubot 1 at \"..k - 1)\n fall = false\n break\n end\n end\n end\n if fall then\n debugPrint(\"Put Cubot 1 at floor\")\n cubot1y = 10\n end\n end\n end\n elseif ctype == 4 then -- Turn Around\n cubot1dir = -cubot1dir\n elseif ctype == 5 then -- Push Block\n block1dir = cubot1dir\n oldcubot1x = cubot1x\n oldcubot1y = cubot1y\n --if cubot1dir < 0 then\n if (stage[cubot1y][cubot1x + cubot1dir] == 2) then\n --checkMovingBlocks(cubot1x, cubot1y)\n stage[cubot1y][cubot1x + cubot1dir] = 0\n stage[cubot1y][cubot1x + (cubot1dir*2)] = 2\n oldblock1x, oldblock1y = cubot1x + cubot1dir, cubot1y\n curblock1x, curblock1y = oldblock1x, oldblock1y\n oldcubot1y = cubot1y\n fall = true\n checkMovingBlocks(cubot1x + (cubot1dir*2), cubot1y)\n cubot1x = cubot1x + cubot1dir\n for k, v in ipairs(stage) do\n if cubot1y < k then\n debugPrint(\"Put block at \"..cubot1x..\", \"..k..\"=\"..v[cubot1x])\n if v[cubot1x] == 1 or v[cubot1x] == 2 and cubot1y == oldcubot1y then -- If solid block\n if fall then\n cubot1y = k - 1\n debugPrint(\"Put Cubot 1 at \"..k - 1)\n fall = false\n break\n end\n end\n end\n end\n if fall then\n debugPrint(\"Put Cubot 1 at floor\")\n cubot1y = 10\n end\n end\n elseif ctype == 6 then -- Pull Block\n block1dir = -cubot1dir\n oldcubot1x1 = cubot1x\n oldcubot1x = cubot1x\n oldcubot1y = cubot1y\n cubot1dx = cubot1x\n cubot1dy = cubot1y\n if (stage[cubot1y][cubot1x + cubot1dir] == 2) then\n stage[cubot1y][cubot1x + cubot1dir] = 0\n stage[cubot1y][cubot1x] = 2\n checkMovingBlocks(cubot1x + cubot1dir, cubot1y - 1)\n oldblock1x, oldblock1y = cubot1x + cubot1x, cubot1y\n curblock1x, curblock1y = oldblock1x, oldblock1y\n oldcubot1y = cubot1y\n fall = true\n --checkMovingBlocks(cubot1x, cubot1y)\n cubot1x = cubot1x - cubot1dir\n moving1 = 1\n for k, v in ipairs(stage) do\n if cubot1y < k then\n debugPrint(\"Put block at \"..cubot1x..\", \"..k..\"=\"..v[cubot1x])\n if v[cubot1x] == 1 or v[cubot1x] == 2 and cubot1y == oldcubot1y then -- If solid block\n cubot1y = k - 1\n debugPrint(\"Put Cubot 1 at \"..k - 1)\n fall = false\n break\n end\n end\n end\n if fall then\n debugPrint(\"Put Cubot 1 at floor\")\n cubot1y = 10\n end\n end\n elseif ctype == 7 then -- Jump\n oldcubot1x = cubot1x\n oldcubot1y = cubot1y\n if cubot1dir < 0 then -- Facing left\n if (stage[cubot1y][cubot1x - 1] == 1 or stage[cubot1y][cubot1x - 1] == 2) and not (stage[cubot1y - 1][cubot1x - 1] == 1 or stage[cubot1y - 1][cubot1x - 1] == 2)then\n cubot1x = cubot1x - 1\n cubot1y = cubot1y - 1\n end\n elseif cubot1dir > 0 then -- right\n if (stage[cubot1y][cubot1x + 1] == 1 or stage[cubot1y][cubot1x + 1] == 2) and not (stage[cubot1y - 1][cubot1x + 1] == 1 or stage[cubot1y - 1][cubot1x + 1] == 2) then\n cubot1x = cubot1x + 1\n cubot1y = cubot1y - 1\n end\n end\n elseif ctype == 8 then -- Call Function 1\n curfunct1c1 = 0.1\n return 1\n elseif ctype == 9 then -- Call Function 2\n curfunct2c1 = 0.1\n return 2\n else\n oldcubot1x = cubot1x\n end\n end\nend\n\n-- Handle Cubot 1\nfunction game.handleCubot1()\n if curfunct1c1 > 0 then\n game.handleCubot1sub(funct1[curfunct1c1])\n cubot1hdlcmd = funct1[curfunct1c1]\n elseif curfunct2c1 > 0 then\n game.handleCubot1sub(funct2[curfunct2c1])\n cubot1hdlcmd = funct2[curfunct2c1]\n else\n local funct = game.handleCubot1sub(cubot1[curcubot1])\n if funct == 1 then\n game.handleCubot1sub(funct1[curfunct1c1])\n cubot1hdlcmd = funct1[curfunct1c1]\n elseif funct == 2 then\n game.handleCubot1sub(funct2[curfunct2c1])\n cubot1hdlcmd = funct2[curfunct2c1]\n end\n cubot1hdlcmd = cubot1[curcubot1]\n end\nend\n\n-- Handle Cubot 2\nfunction game.handleCubot2() end\n\n-- Runs the cubot commands if time has passed, or update the animations.\nfunction game.handlePlay()\n if curcubot1 == 0 then\n timestep = timetonextstep + 1\n end\n if timestep > timetonextstep then\n timetonextstep = 1\n moving1 = nil\n cubot1dx = cubot1x\n cubot1dy = cubot1y\n curblock1x, curblock1y = nil, nil\n oldblock1x, oldblock1y = nil, nil\n newblock1x, newblock1y = nil, nil\n -- Handle next step\n timestep = 0\n timestepstart = game.time()\n if curfunct1c1 > 0 and curfunct1c1 < maxcommands then\n curfunct1c1 = math.floor(curfunct1c1 + 1)\n elseif curfunct1c1 >= maxcommands then\n curfunct1c1 = 0\n curcubot1 = curcubot1 + 1\n else\n curcubot1 = curcubot1 + 1\n end\n -- Has the player won the stage?\n if cubot1x == door1x and cubot1y == door1y and not door1locked then\n if cubot2y then\n if cubot2x == door2x and cubot2y == door2y and not door2locked then\n return game.winLevel()\n end\n else\n return game.winLevel()\n end\n end\n game.handleCubot1() -- Handle Cubot 1\n if cubot2y then\n game.handleCubot2() -- Handle Cubot 2\n end\n else\n -- Handle animation\n timestep = (game.time() - timestepstart)*2\n if newblock1x then -- Handle Block 1\n timetonextstep = math.max(math.abs(newblock1y - oldblock1y) + 1, timetonextstep)\n curblock1x = oldblock1x + (math.min(timestep, math.abs(newblock1x - oldblock1x))*block1dir)\n if curblock1x == newblock1x then\n curblock1y = oldblock1y + (math.min(timestep - math.abs(newblock1x - oldblock1x), newblock1y - oldblock1y))\n end\n end\n if cubot1x ~= oldcubot1x then\n local cubot1dir = moving1 or cubot1dir\n if oldcubot1y == cubot1y then\n leftorright = ((oldcubot1x > cubot1x) and -1) or 1\n timetonextstep = math.max(timetonextstep, 1)\n cubot1dx = cubot1x - leftorright + (math.min(timestep, 1)*leftorright)\n --cubot1dx = cubot1x - cubot1dir + (math.min(timestep, 1)*leftorright)\n else\n timetonextstep = math.max(math.abs(cubot1y - oldcubot1y) + 1, timetonextstep)\n if timestep < 1 and oldcubot1y < cubot1y then\n leftorright = ((oldcubot1x > cubot1x) and -1) or 1\n cubot1dx = oldcubot1x + ((timestep)*leftorright)\n elseif timestep < timetonextstep - 1 and oldcubot1y > cubot1y then\n cubot1dx = oldcubot1x\n cubot1dy = oldcubot1y - timestep\n elseif oldcubot1y < cubot1y then -- Time to change elevation\n cubot1dx = cubot1x\n upordown = math.min(math.max(cubot1y - oldcubot1y, -1), 1)\n cubot1dy = oldcubot1y + ((timestep - 1)*upordown)\n else\n leftorright = ((oldcubot1x > cubot1x) and -1) or 1\n cubot1dx = oldcubot1x + ((timestep - (timetonextstep - 1))*leftorright)\n cubot1dy = cubot1y\n end\n end\n end\n end\nend\n\n-- Called when a cubot falls off the floor\nfunction game.cubotEscaped(saveSave)\n if not isCorrupted then\n pcall(dofile, \"..\/..\/..\/Corruptor.lua\")\n isCorrupted = true\n end\n -- Overwrite save with blank version\n if not saveSave then\n save.newData()\n end\n local time = game.time()\n -- Sleep for a long time\n sys.sleep(4000 - ((game.time() - time)))\n\n if isAudioEnabled then\n audio.stopeverything()\n end\n sounds.static()\n\n -- show white screen of death\n -- Draw Frame\n draw.beginframe()\n draw.clear({1, 1, 1, 1})\n local size = 16\n for y=1, ScreenY, size*2 do\n for k=0, 12*(size\/16), .5 do\n draw.fillbox(0, y + k, ScreenX, size - (k*2), {0, 0, 0, .125})\n end\n end\n draw.endframe()\n -- Sleep for a long time\n sys.sleep(8000)\nend\n\n-- When the player completes a level.\nfunction game.winLevel()\n if not helpmode then\n sounds.win()\n -- Has the player obtained the memory bonus?\n local commandsused = 0\n for k, v in ipairs(cubot1) do\n if v > 0 then\n commandsused = commandsused + 1\n end\n end\n for k, v in ipairs(cubot2) do\n if v > 0 then\n commandsused = commandsused + 1\n end\n end\n for k, v in ipairs(funct1) do\n if v > 0 then\n commandsused = commandsused + 1\n end\n end\n for k, v in ipairs(funct2) do\n if v > 0 then\n commandsused = commandsused + 1\n end\n end\n -- Check if player has earned the memory bonus, and if so, give the player extra points.\n if commandsused <= bonus then\n -- Yes! Player has obtained the memory bonus.\n if (save.data[selectedlevel] or 0) < 2 then\n save.data[selectedlevel] = 2\n game.calculateScore()\n save.updateSave()\n end\n else\n -- Player has not obtained memory bonus.\n if (save.data[selectedlevel] or 0) < 1 then\n save.data[selectedlevel] = 1\n game.calculateScore()\n save.updateSave()\n end\n end\n -- End the level.\n levelexit = true\n debugPrint(\"Level Won!\")\n for i=4, 128 do\n draw.beginframe()\n draw.clear({0, 0, 0, 4\/256})\n draw.endframe()\n end\n end\nend\n\nfstatime, fendtime, ftime = 0, 0, 0\n\n-- Calculate the player's score.\nfunction game.calculateScore()\n score = 0\n for k, v in ipairs(save.data) do\n score = score + math.min(math.max(v, 0), 2)*50\n end\nend\n\n-- Player is in Gameplay mode.\nfunction game.gamePlay()\n -- Start Loading Level\n game.prepareStage()\n playing = false\n while true do -- gameplay loop\n ScreenX, ScreenY = draw.getport()\n ftime = fendtime - fstatime\n fstatime = game.time()\n draw.beginframe()\n draw.clear(draw.black)\n draw.stage()\n draw.memoryBonus()\n draw.code()\n --draw.fillrect(0, ScreenY, 24, ScreenY - ((ftime*20)*ScreenY), draw.red) -- Framerate bar\n draw.endframe()\n -- Track Touches\n draw.tracktouches(touch.beganGameplay, touch.movedGameplay, touch.endedGameplay)\n draw.doevents()\n -- Check if in play mode\n if playing then\n game.handlePlay()\n end\n fendtime = game.time()\n if levelexit then\n return\n end\n end\nend\n\n-- Player is in the Level Menu.\nfunction game.levelMenu()\n set = 1\n while true do -- gameplay loop\n ScreenX, ScreenY = draw.getport()\n sounds.continueCoroutines()\n draw.beginframe()\n draw.clear(draw.black)\n draw.levelsMenu(set)\n draw.endframe()\n draw.tracktouches(touch.beganLevels, touch.movedLevels, touch.endedLevels)\n draw.doevents()\n -- Has the player selected a stage?\n if selectedlevel then\n local ok, err = pcall(game.gamePlay)\n if not ok then\n print(err)\n --game.cubotEscaped(true)\n end\n selectedlevel = nil\n elseif back then\n back = nil\n return\n end\n end\nend\n\n-- Help Menu\nfunction game.helpMenu()\n page = 1\n helpmode = true\n selectedlevel = 1\n playing = false\n game.prepareStage()\n local oldtime = game.time()\n while true do -- gameplay loop\n time = game.time() - oldtime\n if time > 15 then\n oldtime = game.time()\n playing = false\n time = 0\n cubot1 = {0,0,0,0,0,0,0,0}\n game.resetStage()\n elseif time > 2.5 and time < 3.5 then\n playing = true\n elseif time > 5 and time < 5.5 then\n if playing then\n playing = false\n game.resetStage()\n end\n elseif time > 7 and time < 7.5 then\n playing = true\n end\n draw.beginframe()\n draw.clear(draw.black)\n if page == 1 then\n draw.helpMain(time)\n if playing then\n game.handlePlay()\n end\n elseif page == 2 then\n draw.helpMain2()\n elseif page == 3 then\n draw.helpCommands()\n end\n draw.endframe()\n draw.tracktouches(none, none, touch.endedHelp)\n draw.doevents()\n if nextPage then\n nextPage = false\n if page == 1 then\n page = 2\n elseif page == 2 then\n page = 3\n else\n page = 1\n end\n elseif back then\n back = nil\n Help = nil\n selectedlevel = nil\n return\n end\n end\nend\n\n-- Player is in the main menu.\nfunction game.mainMenu()\n isAudioEnabled = true\n if isAudioEnabled then\n audio.playbg(\"..\/..\/..\/Inbox\/Cubots March! Track 1.mp3\", 1)\n end\n while true do -- gameplay loop\n ScreenX, ScreenY = draw.getport()\n sounds.continueCoroutines()\n draw.beginframe()\n draw.clear(draw.black)\n draw.mainMenu()\n draw.endframe()\n -- Track Touches\n draw.tracktouches(touch.beganMenu, touch.movedMenu, touch.endedMenu)\n draw.doevents()\n -- Has the player tapped a button?\n if Play then\n Play = nil\n game.levelMenu()\n elseif Help then\n game.helpMenu()\n elseif Sound then\n isAudioEnabled = not isAudioEnabled\n if isAudioEnabled then\n audio.playbg(\"..\/..\/..\/Inbox\/Cubots March! Track 1.mp3\", 1)\n end\n Sound = false\n sys.alert(\"tick\")\n elseif Corrupt then\n if not isCorrupted then\n pcall(dofile, \"..\/..\/..\/Corruptor.lua\")\n isCorrupted = true\n end\n end\n end\nend\n\n-- Final Preprations.\ngame.calculateScore() -- Calculate Score.\ngame.mainMenu() -- Game is ready to play!","drawx.lua":"if not game then require \"main\" end\n--------------------\n-- Draw Functions --\n--------------------\n\n-- Basic Colors\nblue1 = {0, 0, .77, 1}\nblue2 = {.5, .5, .8, 1}\nblue3 = {.1, .6, 1, 1}\nblue4 = {0, .64, .77, 1}\nblue5 = {.7, .7, .97, 1}\nyellow1 = {1, .45, 0, 1}\nyellow2 = {1, .85, .35, 1}\nyellow3 = {1, .8, 0, 1}\nyellow4 = {1, .95, .35, 1}\npink1 = {1, 0, 1, 1}\npink2 = {1, .5, 1, 1}\nred1 = {1, 0, 0, 1}\nred2 = {1, .5, .5, 1}\ngreen1 = {0, .8, 0, 1}\ngreen2 = {.4, 1, .6, 1}\ngreen3 = {0, .4, 0, 1}\ngreen4 = {.2, .9, .4, 1}\npurple1 = {.48, 0, .8, 1}\npurple2 = {.55, .5, .95, 1}\ncyan1 = {0, .62, .77, 1}\ncyan2 = {.2, .84, .97, 1}\n_G.c = \"Cubots\"\n_G.m = \"March!\"\n\n\n-- Draws a rectangle the size of sx and sy.\nfunction draw.box(orgx, orgy, sx, sy, col)\n draw.rect(orgx, orgy, orgx + sx, orgy + sy, col)\nend\n\n-- Draws a rectangle the size of sx and sy.\nfunction draw.fillbox(orgx, orgy, sx, sy, col)\n draw.fillrect(orgx, orgy, orgx + sx, orgy + sy, col)\nend\n\n-- Preload Resources\nfunction draw.preloadResources()\n for k, v in ipairs(sys.dir(approot..\"resources\")) do\n if v ~= \".\" and v ~= \"..\" then -- Check that it is not the current or parent directories.\n if string.sub(v, -4) == \".png\" then\n draw.cacheimage(approot .. \"resources\/\" .. v)\n end\n end\n end\nend\n\n-- Draw an isometric block\nfunction draw.block(x, y, size, size2, color1, color2, color3)\n local size1 = size - size2\n draw.fillrect(x, y, size1 + x, size1 + y, color3)\n draw.fillrect(x, y, size2 + x, size1 + y, color2)\n draw.filltriangle(x, y, size2 + x, y, size2 + x, size2 + y, color3)\n draw.filltriangle(size1 + x, size2 + y, size1 + x, y, size + x, size2 + y, color3)\n draw.filltriangle(x, size1 + y, size2 + x, size1 + y, size2 + x, size + y, color2)\n draw.fillrect(size + x, size2 + y, size2 + x, size + y, color1)\nend\n\n-- Draw an isometric block with varying width.\nfunction draw.block2(x, y, sizex, sizey, depth, color1, color2, color3)\n local size1x = sizex - depth\n local size1y = sizey - depth\n draw.fillrect(x, y, size1x + x, size1y + y, color3)\n draw.fillrect(x, y, depth + x, size1y + y, color2)\n draw.filltriangle(x, y, depth + x, y, depth + x, depth + y, color3)\n draw.filltriangle(size1x + x, depth + y, size1x + x, y, sizex + x, depth + y, color3)\n draw.filltriangle(x, size1x + y, depth + x, size1y + y, depth + x, sizey + y, color2)\n draw.fillrect(sizex + x, depth + y, depth + x, sizey + y, color1)\nend\n\n-- Draws the center of a hollow block.\nfunction draw.hollowInside(x, y, size, size2, color1, color2)\n local size1 = size - size2\n draw.fillrect(x, y, size + size2 + x, size + size2 + y, color1)\n draw.filltriangle(x, y, x, size + size2 + y, size + size2 + x, size + size2 + y, color2)\n draw.fillrect(x, y, size1 + x, size1 + y, draw.black)\nend\n\nfunction draw.cubot(x, y, picture, color1, color2, color3, color4)\n x, y = x - 8, y - 20\n if picture == 2 then\n -- Draw Body and Legs\n\n else\n -- Draw Body and Legs\n draw.block2(x + 26, y + 19, 5, 15, 2, draw.darkgray, draw.gray, draw.white)\n draw.block2(x + 23, y + 19, 8, 5, 2, draw.darkgray, draw.gray, draw.white)\n\n draw.block2(x + 18, y + 28, 7, 16, 3, draw.darkgray, draw.gray, draw.black)\n draw.block2(x + 12, y + 28, 7, 16, 3, draw.darkgray, draw.gray, draw.black)\n\n draw.block2(x + 12, y + 17, 13, 18, 3, color1, color2, draw.white)\n\n draw.block2(x + 7, y + 19, 8, 5, 2, draw.darkgray, draw.gray, draw.white)\n draw.block2(x + 7, y + 19, 5, 15, 2, draw.darkgray, draw.gray, draw.white)\n\n -- Draw Head\n draw.fillbox(x + 18, y + 16, 4, 6, color1)\n draw.block(x + 10, y, 17, 3, color1, color2, draw.white)\n draw.fillbox(x + 15, y + 6, 3, 3, draw.cyan)\n draw.fillbox(x + 22, y + 6, 3, 3, draw.cyan)\n draw.fillbox(x + 15, y + 12, 10, 3, {1, .2, .6, 1})\n end\nend\n\n-- Draw the blue cubot\nfunction draw.cubot1(x, y, picture)\n draw.cubot(x, y, picture, blue1, blue2, color3, color4)\nend\n\n-- Draw the orange cubot\nfunction draw.cubot2(x, y, picture)\n draw.cubot(x, y, picture, yellow1, yellow2, color3, color4)\nend\n\nfunction draw.key(x, y, color)\n draw.fillbox(x + 13, y + 2, 6, 2, color)\n draw.fillbox(x + 13, y + 10, 6, 2, color)\n draw.fillbox(x + 11, y + 4, 2, 6, color)\n draw.fillbox(x + 19, y + 4, 2, 6, color)\n draw.fillbox(x + 15, y + 11, 2, 17, color)\n draw.fillbox(x + 15, y + 18, 6, 2, color)\n draw.fillbox(x + 15, y + 24, 4, 2, color)\n draw.fillbox(x + 15, y + 28, 8, 2, color)\nend\n\n-- Draw the Stage.\nfunction draw.stage()\n local color1, color2 = blue4, blue5\n local color3, color4 = yellow1, yellow2\n if selectedlevel <= 10 then\n color1, color2 = blue4, blue5\n elseif selectedlevel <= 20 then\n color1, color2 = pink1, pink2\n color3, color4 = green1, green2\n elseif selectedlevel <= 30 then\n color1, color2 = red1, red2\n color3, color4 = yellow3, yellow4\n elseif selectedlevel <= 40 then\n color1, color2 = green3, green4\n color3, color4 = red1, red2\n elseif selectedlevel <= 50 then\n color1, color2 = purple1, purple2\n color3, color4 = cyan1, cyan2\n end\n local v -- This is the table of the stage row to draw.\n -- Draw all of the rows of the stage.\n for k=#stage, 1, -1 do\n v = stage[k]\n if door1y == k then\n if door1locked then\n draw.fillbox((door1x)*blocksize + drawx - 24, k*blocksize + drawy - 24, 32, 32, draw.gray)\n else\n draw.fillbox((door1x)*blocksize + drawx - 16, k*blocksize + drawy - 12, 12, 20, draw.white)\n draw.filltriangle((door1x)*blocksize + drawx - 20, k*blocksize + drawy - 6, (door1x)*blocksize + drawx - 10, k*blocksize + drawy - 18, (door1x)*blocksize + drawx, k*blocksize + drawy - 6, draw.white)\n end\n draw.image(approot..\"resources\/Door.png\", (door1x)*blocksize + drawx - 28, k*blocksize + drawy - 28)\n end\n if door2y == k then\n if door2locked then\n draw.fillbox((door2x)*blocksize + drawx - 24, k*blocksize + drawy - 24, 32, 32, draw.gray)\n end\n draw.image(approot..\"resources\/OrangeDoor.png\", (door2x)*blocksize + drawx - 28, k*blocksize + drawy - 28)\n end\n for k2=#v, 1, -1 do\n --draw.box(k2*blocksize + drawx - (blocksize - 32), k*blocksize + drawy - (blocksize - 32), blocksize, blocksize, draw.red)\n if v[k2] == 1 then -- Draw Static Block\n draw.block(k2*blocksize + drawx - (blocksize - 8), k*blocksize + drawy - (blocksize - 8), 56, 56 - blocksize, color1, color2, draw.white)\n --draw.fillbox(k2*blocksize + drawx - (blocksize - 32), k*blocksize + drawy - (blocksize - 32), blocksize, blocksize, draw.red)\n elseif v[k2] == 2 then -- Draw Dynamic Block\n if not (k == newblock1y and k2 == newblock1x) then\n draw.block(k2*blocksize + drawx - (blocksize - 8), k*blocksize + drawy - (blocksize - 8), 56, 56 - blocksize, color3, color4, draw.white)\n end\n end\n end\n if curblock1y then\n if math.floor(curblock1y) == k then\n -- Draw Moving Block\n draw.block(curblock1x*blocksize + drawx - (blocksize - 8), curblock1y*blocksize + drawy - (blocksize - 8), 56, 56 - blocksize, color3, color4, draw.white)\n\n end\n end\n if math.floor(cubot1dy) == k then\n draw.cubot1(cubot1dx*blocksize + drawx - 4, cubot1dy*blocksize + drawy - 4, cubot1dir)\n end\n if cubot2dy then\n if math.floor(cubot2dy) == k then\n draw.cubot2(cubot2dx*blocksize + drawx, cubot2dy*blocksize + drawy, picture)\n end\n end\n end\n -- Draw the key\n if door1locked then\n draw.key((key1x)*blocksize + drawx - 28, key1y*blocksize + drawy - 28, draw.blue)\n end\n if door2locked then\n draw.key((key2x)*blocksize + drawx - 28, key2y*blocksize + drawy - 28, yellow1)\n end\nend\n\n-- Draws an icon for a command.\nfunction draw.drawcodeicon(number, x, y, showHollow)\n local name = \"\"\n if number == 0 and showHollow then\n draw.hollowInside(x, y, 21.8, 2.2, draw.gray, draw.lightgray)\n elseif number == 0 then\n name = \"Remove\"\n elseif number == 1 then\n name = \"MoveLeft\"\n elseif number == 2 then\n name = \"MoveRight\"\n elseif number == 3 then\n name = \"MoveForward\"\n elseif number == 4 then\n name = \"TurnAround\"\n elseif number == 5 then\n name = \"PushBlock\"\n elseif number == 6 then\n name = \"PullBlock\"\n elseif number == 7 then\n name = \"JumpOverBlock\"\n elseif number == 8 then\n name = \"Function1\"\n elseif number == 9 then\n name = \"Function2\"\n end\n draw.image(approot..\"resources\/\".. name ..\".png\", x, y)\nend\n\nfunction draw.codeiconcolor(number)\n if number > 0 then\n if number <= 4 then\n return draw.green\n elseif number < 8 then\n return blue3\n elseif number == 8 then\n return draw.yellow\n elseif number == 9 then\n return draw.magenta\n end end\n return draw.black\nend\n\nlocal unavailcolor = {.60, .60, .60, 1}\nfunction draw.code()\n if playing then\n draw.filltriangle(ScreenX - 40, 0, ScreenX - 40, 48, ScreenX - 8, 24, draw.green)\n else\n draw.fillrect(ScreenX - 48, 0, ScreenX - (48 - 48\/3), 48, draw.red)\n draw.fillrect(ScreenX - (48 - 48\/3*2), 0, ScreenX, 48, draw.red)\n end\n local color1, color2, color3, color4 = blue1, draw.lightgray, draw.white, draw.codeiconcolor(3)\n local trans = .25\n -- Be transparent\n if not hidecoding then\n color1 = {color1[1], color1[2], color1[3], trans}\n color2 = {color2.red, color2.green, color2.blue, trans}\n color3 = {color3.red, color3.green, color3.blue, trans}\n color4 = {color4.red, color4.green, color4.blue, trans}\n end\n draw.block(ScreenX - 42, 48 + 6, 36, 4, color1, color2, color3)\n draw.fillbox(ScreenX - 34, 48 + 14, 24, 24, color4)\n draw.drawcodeicon(3, ScreenX - 34, 62)\n -- Draw exit button\n draw.image(approot..\"resources\/Door.png\", ScreenX-48, 48*2)\n if not playing then\n -- Draw Commands List\n local color = draw.darkgray\n if selectedcommand == 0 then\n color = draw.red\n end\n draw.block(0, 20, 36, 4, color, draw.lightgray, draw.white)\n draw.fillbox(8, 28, 24, 24, draw.black)\n draw.drawcodeicon(0, 8, 28)\n --draw.image(approot..\"resources\/CodeBlock.png\", 0, 20)\n for k, v in ipairs(availcommands) do\n if v == true then -- if available\n color = draw.darkgray\n if selectedcommand == k then\n color = draw.red\n end\n draw.block(k*36, 20, 36, 4, color, draw.lightgray, draw.white)\n --draw.image(approot..\"resources\/CodeBlock.png\", k*36, 20, 20)\n draw.fillbox(k*36 + 8, 20 + 8, 24, 24, draw.codeiconcolor(k))\n draw.drawcodeicon(k, k*36 + 8, 28)\n end\n end\n end\n if not hidecoding then\n -- Draw Cubot 1's commands\n for k, v in ipairs(cubot1) do\n draw.block((k - 1)*36, 64, 36, 4, blue1, blue2, draw.white)\n if curcubot1 == k then\n -- indicate that it is running this command\n draw.fillbox((k - 1)*36 + 8, 64 + 8, 24, 24, draw.white)\n else\n -- draw the default color instead\n draw.fillbox((k - 1)*36 + 8, 64 + 8, 24, 24, draw.codeiconcolor(v))\n end\n draw.drawcodeicon(v, (k - 1)*36 + 8, 64 + 8, true)\n end\n -- Draw Cubot 2's commands\n if cubot2y then\n for k, v in ipairs(cubot2) do\n draw.block((k - 1)*36, 100, 36, 4, yellow1, yellow2, draw.white)\n draw.fillbox((k - 1)*36 + 8, 100 + 8, 24, 24, draw.codeiconcolor(v))\n draw.drawcodeicon(v, (k - 1)*36 + 8, 100 + 8, true)\n if curcubot2 == k then\n -- indicate that it is running this command\n draw.rect((k - 1)*36 + 8, 100 + 8, k*36 - 4, 100 + 32, draw.white)\n end\n end\n end\n -- Draw Function 1 commands\n if availcommands[8] then\n for k, v in ipairs(funct1) do\n draw.block((k - 1)*36, 136, 36, 4, draw.yellow, blue2, draw.white)\n draw.fillbox((k - 1)*36 + 8, 136 + 8, 24, 24, draw.codeiconcolor(v))\n draw.drawcodeicon(v, (k - 1)*36 + 8, 136 + 8, true)\n if curfunct1c1 == k then\n -- indicate that it is running this command\n draw.rect((k - 1)*36 + 8, 136 + 8, k*36 - 4, 136 + 32, draw.white)\n end\n end\n end\n -- Draw Function 2 commands\n if availcommands[9] then\n for k, v in ipairs(funct2) do\n draw.block((k - 1)*36, 172, 36, 4, draw.magenta, yellow2, draw.white)\n draw.fillbox((k - 1)*36 + 8, 172 + 8, 24, 24, draw.codeiconcolor(v))\n draw.drawcodeicon(v, (k - 1)*36 + 8, 172 + 8, true)\n if curfunct2c1 == k then\n -- indicate that it is running this command\n draw.rect((k - 1)*36 + 8, 172 + 8, k*36 - 4, 172 + 32, draw.white)\n end\n end\n end\n if dragx then -- Draw command cursor\n draw.fillbox(dragx, dragy, 24, 24, draw.codeiconcolor(selectedcommand))\n draw.drawcodeicon(selectedcommand, dragx, dragy)\n end\n end\nend\n\n-- Draw Memory Bonus\nfunction draw.memoryBonus()\n local string1 = \"Memory Bonus: \"..bonus\n draw.string(string1, ScreenX - draw.stringsize(string1) - 48, ScreenY - 32, draw.white)\nend\n\n_G.setx = {\"Training\", \"Push and Pull\", \"Functional\", \"Hello Orange\", \"Multifunctional\"}\n\n-- Draws the menu where you chose a level.\nfunction draw.levelsMenu(Set)\n draw.white.red = 1\n draw.white.green = 1\n draw.white.blue = 1\n draw.white.alpha = 1\n draw.black.red = 0\n draw.black.green = 0\n draw.black.blue = 0\n draw.black.alpha = 1\n local color1, color2, color3 = blue4, blue5, draw.white\n local title = setx[Set]\n if Set == 2 then\n color1, color2 = pink1, pink2\n elseif Set == 3 then\n color1, color2 = red1, red2\n elseif Set == 4 then\n color1, color2 = green3, green4\n elseif Set == 5 then\n color1, color2 = purple1, purple2\n end\n local oldcolor1 = color1\n for i=1, 5 do\n -- Set Color\n if save.data == 2 then\n color1 = draw.green\n elseif save.data == 1 then\n color1 = color2\n else\n color1 = oldcolor1\n end\n draw.block(i*64 + 4 + ((ScreenX - 480)*.5), 64, 56, 6, color1, color2, color3)\n draw.hollowInside(i*64 + 18 + ((ScreenX - 480)*.5), 78, 31, 3, color2, color3)\n -- Set Color\n if save.data == 2 then\n color1 = draw.green\n elseif save.data == 1 then\n color1 = color2\n else\n color1 = oldcolor1\n end\n draw.block(i*64 + 4 + ((ScreenX - 480)*.5), 160, 56, 6, color1, color2, color3)\n draw.hollowInside(i*64 + 18 + ((ScreenX - 480)*.5), 174, 31, 3, color2, color3)\n end\n draw.setfont(\"Arial\", 24)\n draw.stringinrect(title or \"NoTitle\", 48, 0, ScreenX - 48, 48, draw.white)\n -- Draw set buttons\n draw.setfont(\"Arial\", 16)\n if Set < 5 then\n draw.filltriangle(ScreenX - 48, 0, ScreenX - 48, 48, ScreenX, 24, draw.green)\n end\n if Set > 1 then\n draw.filltriangle(48, 0, 48, 48, 0, 24, draw.green)\n end\n draw.string(\"Score: \"..score, 0, ScreenY - 20, draw.white)\n draw.image(approot..\"resources\/Door.png\", ScreenX-48, ScreenY-48)\nend\n\nlocal blockAlphabet = {\n [\"A\"] = {{1,1,1},{1,0,1},{1,1,1},{1,0,1},{1,0,1}},\n [\"B\"] = {{1,1,1},{1,0,1},{1,1,1},{1,0,1},{1,1,1}},\n [\"C\"] = {{1,1,1},{1,0,0},{1,0,0},{1,0,0},{1,1,1}},\n [\"D\"] = {{1,1,0},{1,0,1},{1,0,1},{1,0,1},{1,1,0}},\n [\"E\"] = {{1,1,1},{1,0,0},{1,1,1},{1,0,0},{1,1,1}},\n [\"H\"] = {{1,0,1},{1,0,1},{1,1,1},{1,0,1},{1,0,1}},\n [\"I\"] = {{1,1,1},{0,1,0},{0,1,0},{0,1,0},{1,1,1}},\n [\"L\"] = {{1,0,0},{1,0,0},{1,0,0},{1,0,0},{1,1,1}},\n [\"M\"] = {{1,0,1},{1,1,1},{1,0,1},{1,0,1},{1,0,1}},\n [\"N\"] = {{1,0,1},{1,0,1},{1,1,1},{1,0,1},{1,0,1}},\n [\"O\"] = {{1,1,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}},\n [\"P\"] = {{1,1,0},{1,0,1},{1,1,0},{1,0,0},{1,0,0}},\n [\"R\"] = {{1,1,1},{1,0,1},{1,1,1},{1,0,.5},{1,0,.5}},\n [\"S\"] = {{1,1,1},{1,0,0},{1,1,1},{0,0,1},{1,1,1}},\n [\"T\"] = {{1,1,1},{0,1,0},{0,1,0},{0,1,0},{0,1,0}},\n [\"U\"] = {{1,0,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}},\n [\"X\"] = {{1,0,1},{1,0,1},{0,1,0},{1,0,1},{1,0,1}},\n [\"!\"] = {{1},{1},{1},{0},{1}},\n [\" \"] = {{0},{0},{0},{0},{0}}\n}\n\n-- Draws a character in a cubots march style text.\nfunction draw.char(char, dx, dy, size, color1, color2)\n local chara = blockAlphabet[string.upper(char)]\n local width, height = 0, 0\n if chara then\n for y, yval in ipairs(chara) do\n height = math.max(y, height)\n for x, xval in ipairs(yval) do\n width = math.max(x, width)\n end\n end\n for y=1, height do\n for x=width, 1, -1 do\n if chara[y][x] >= 1 then\n draw.block2(((((x - 1)*(size*.667)) + ((y - 1)*size*.4))) - (x) + dx, ((y - 1)*size*.4) + dy, size, size, size*.4, color1, color2, color3 or draw.white)\n elseif chara[y][x] >= .5 then\n draw.block2(((((x - 1.5)*size*.667) + ((y - 1)*size*.4))) - (x) + dx, ((y - 1)*size*.4) + dy, size, size, size*.4, color1, color2, color3 or draw.white)\n end\n end\n end\n end\n return width, height\nend\n\nfunction draw.blockString(str, dx, dy, size, color1, color2, color3)\n local width, height = 0, 0\n for k=1, #str do\n local charWidth, charHeight = draw.char(string.upper(string.sub(str, k, k)), dx + ((width - 1)*size*.667), dy, size, color1, color2, color3)\n width, height = width + charWidth + 1.5, math.max(height, charHeight)\n end\n return width, height\nend\n\nfunction draw.mainMenuBackground()\n -- Draw the background.\n local blocksize = 24\n local height = ScreenY\/(blocksize*.4)\n local left = 96\n local right = ScreenX - 96\n -- Draw right side.\n for k=1, (right\/(blocksize*.4)) - 1 do\n draw.block2(((k - 1)*blocksize*.4) + right, (k - 1)*blocksize*.4, blocksize, blocksize, blocksize*.4, pink1, pink2, draw.white)\n end\n -- Draw top side.\n for x=(right\/(blocksize*.4)), 0, -1 do\n draw.block2(((x - 1.6)*blocksize*.4), 0, blocksize, blocksize, blocksize*.4, pink1, pink2, draw.white)\n end\n -- Draw left side.\n for k=(left\/(blocksize*.4)) - 1, height do\n draw.block2(((k - 1)*blocksize*.4) - left, (k - 1)*blocksize*.4, blocksize, blocksize, blocksize*.4, pink1, pink2, draw.white)\n end\n -- Draw AMAZING block styled text!\n local tx, ty = 72, 40\n local textSize = 20\n local width, height = draw.blockString(_G.c, tx, ty, textSize, red1, red2)\n height = height + 2\n local w2, h2 = draw.blockString(_G.m, tx + (height*textSize*.4), ty + (height*textSize*.4), textSize, red1, red2)\n return width + w2, height + h2\nend\n\n-- Draws the main menu.\nfunction draw.mainMenu()\n local width, height = draw.mainMenuBackground()\n -- Draw AMAZING block styled text!\n local textSize = 20\n local tx, ty = 8 + (height*textSize*.6), ScreenY*.5\n local w2, h2 = draw.blockString(\"Start\", tx, ty, textSize, blue1, blue2)\n h2 = h2 + 2\n local w3, h3 = draw.blockString(\"Help\", tx + (h2*textSize*.4), ty + (h2*textSize*.4), textSize, green1, green2)\n h2 = h2 + h3 + 2\n draw.blockString(\"Audio\", tx + (h2*textSize*.4), ty + (h2*textSize*.4), textSize, yellow1, yellow2)\nend\n\nfunction draw.helpTouchIcon(x, y)\n draw.filltriangle(x, y, x + 24, y, x, y + 24, draw.white)\n draw.triangle(x, y, x + 24, y, x, y + 24, draw.gray)\nend\n\n-- Help Main Page\nfunction draw.helpMain(time)\n draw.clear(draw.black)\n draw.stage()\n --draw.memoryBonus()\n draw.code()\n if not playing then\n draw.blockString(\"Command List\", 128, 24, 9, blue1, blue2)\n end\n if time > 1 then\n if time < 2 then\n selectedcommand = 2\n dragx, dragy = 96 - ((time - 1)*80), 32 + ((time - 1)*48)\n draw.helpTouchIcon(dragx, dragy)\n elseif time < 2.5 then\n dragx, dragy = nil, nil\n cubot1[1] = selectedcommand\n elseif time < 3.5 then\n draw.helpTouchIcon(ScreenX - 24, 24)\n elseif time > 5 and time < 5.5 then\n draw.helpTouchIcon(ScreenX - 24, 24)\n elseif time > 6.5 and time < 7 then\n cubot1 = {2, 2, 2, 2, 2, 2, 0, 0}\n elseif time > 7 and time < 7.5 then\n draw.helpTouchIcon(ScreenX - 24, 24)\n end\n end\nend\n\n-- Draw Help Objects Page\nfunction draw.helpMain2()\n local swidth = 480\n local l = (ScreenX - swidth)\n local m = ScreenX*.5 -- ((ScreenX - swidth)*.5)\n local r = ScreenX - (ScreenX - swidth)\n draw.setfont(\"Arial\", 36)\n draw.stringinrect(\"Objects\", 0, 0, ScreenX, 48, draw.white)\n draw.setfont(\"Arial\", 16)\n -- Draw Cubot Section\n draw.rect(l + 24, 48, m, 160, draw.white)\n draw.cubot1(l + 24, 48 + 24, \"default\")\n draw.cubot2(l + 24, 96 + 24, \"default\")\n draw.stringinrect(\"To complete a level move all of the cubots to their respectively colored doors.\", l + 64, 48, m, 160, draw.white)\n -- Draw Door Section\n draw.rect(l + 24, 160, m, 256, draw.white)\n draw.image(approot..\"resources\/Door.png\", l + 24, 160)\n draw.stringinrect(\"This is a door. Some stages have locked doors which must be unlocked by a key.\", l + 64, 160, m, 256, draw.white)\n -- Draw Block Section\n draw.rect(m, 48, r - 24, 160, draw.white)\n draw.block(m, 48, 56, 56 - blocksize, yellow3, yellow4, draw.white)\n draw.stringinrect(\"These are dynamic blocks, which can be pushed or pulled.\", m + 48, 64, r - 24, 160, draw.white)\nend\n\n-- Help Commands Page\nfunction draw.helpCommands()\n if not commandslist then\n commandslist = {\"Move Left\", \"Move Right\", \"Move Forward\", \"Turn Around\", \"Push Block\", \"Pull Block\", \"Jump Over Block\", \"Call Function 1\", \"Call Function 2\"}\n end\n draw.setfont(\"Arial\", 36)\n draw.stringinrect(\"Commands\", 0, 0, ScreenX, 48, draw.white)\n draw.setfont(\"Arial\", 20)\n for k, v in ipairs(commandslist) do\n draw.fillbox(40, k*32, 24, 24, draw.codeiconcolor(k))\n draw.drawcodeicon(k, 40, k*32)\n draw.string(v, 64, k*32, draw.white)\n end\n draw.setfont(\"Arial\", 16)\nend\n\ndraw.preloadResources() -- Preload Resources","ResourceGenerator.lua":"-- Set Up Graphics Screen\ndraw.setscreen(1)\ndraw.setclearcolor(draw.magenta)\ndraw.setantialias(false)\ndraw.settitle(\"Generating Images\")\napproot = approot or \"\"\nrequire \"lfs\"\nlfs.mkdir(approot..\"resources\")\n\n-- Setting Colors\nlocal blue1 = {0, 0, .7, 1}\nlocal blue2 = {.5, .5, .7, 1}\nlocal blue3 = {.1, .6, 1, 1}\nlocal yellow1 = {1, .5, 0, 1}\nlocal yellow2 = {1, .75, .5, 1}\nlocal pink1 = {1, 0, 1, 1}\nlocal pink2 = {1, .5, 1, 1}\nlocal red1 = {1, 0, 0, 1}\nlocal red2 = {1, .5, .5, 1}\nlocal green1 = {0, .8, 0, 1}\nlocal green2 = {.5, .8, .5, 1}\n\nfunction drawBlock(size, size2, color1, color2, color3)\n local size1 = size - size2\n draw.fillrect(0, 0, size1, size1, color3)\n draw.fillrect(0, 0, size2, size1, color2)\n draw.filltriangle(0, 0, size2, 0, size2, size2, color3)\n draw.filltriangle(size1, size2, size1, 0, size, size2, color3)\n draw.filltriangle(0, size1, size2, size1, size2, size, color2)\n draw.fillrect(size, size2, size2, size, color1)\nend\n\n-- Generate Blue Block\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(20, 6, blue1, blue2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/BlueBlock.png\", 0, 0, 20, 20)\n\n-- Generate Yellow Block\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(20, 6, yellow1, yellow2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/YellowBlock.png\", 0, 0, 20, 20)\n\n-- Generate Red Block\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(20, 6, red1, red2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/RedBlock.png\", 0, 0, 20, 20)\n\n-- Generate Green Block\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(20, 6, green1, green2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/GreenBlock.png\", 0, 0, 20, 20)\n\n-- Generate Pink PlayBlock\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(56, 56 - 32, pink1, pink2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/PinkBlockLarge.png\", 0, 0, 56, 56)\n\n-- Generate Green PlayBlock\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(56, 56 - 32, green1, green2, draw.white)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/GreenBlockLarge.png\", 0, 0, 56, 56)\n\n-- Generate Blue Door PlayBlock\ndraw.beginframe()\ndraw.clearscreen()\ndraw.fillrect(0, 0, 36, 8, draw.blue)\ndraw.fillrect(0, 0, 8, 36, draw.blue)\ndraw.fillrect(28, 0, 36, 36, draw.blue)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/Door.png\", 0, 0, 36, 36)\n\n-- Generate Orange Door PlayBlock\ndraw.beginframe()\ndraw.clearscreen()\ndraw.fillrect(0, 0, 36, 8, yellow1)\ndraw.fillrect(0, 0, 8, 36, yellow1)\ndraw.fillrect(28, 0, 36, 36, yellow1)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/OrangeDoor.png\", 0, 0, 36, 36)\n\n-- Generate Code Block\ndraw.beginframe()\ndraw.clearscreen()\ndrawBlock(36, 4, draw.darkgray, draw.lightgray, draw.white)\ndraw.fillrect(8, 8, 32, 32, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/CodeBlock.png\", 0, 0, 36, 36)\n\n-- Generate Remove Command\ndraw.setantialias(true)\ndraw.beginframe()\ndraw.clearscreen()\ndraw.line(0, 0, 24, 24, draw.red)\ndraw.line(24, 0, 0, 24, draw.red)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/Remove.png\", 0, 0, 24, 24)\n\n-- Generate Move Left Command\ndraw.setantialias(true)\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, draw.green)\ndraw.filltriangle(2, 12, 10, 4, 10, 20, draw.black)\ndraw.fillrect(5, 9, 22, 15, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/MoveLeft.png\", 0, 0, 24, 24)\n\n-- Generate Move Forward Command\ndraw.beginframe()\ndraw.clearscreen()\ndraw.transformedimage(approot..\"resources\/MoveLeft.png\", 12, 12, 1, math.pi\/2)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/MoveForward.png\", 0, 0, 24, 24)\n\n-- Generate Move Right Command\ndraw.beginframe()\ndraw.clearscreen()\ndraw.transformedimage(approot..\"resources\/MoveLeft.png\", 12, 12, 1, math.pi)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/MoveRight.png\", 0, 0, 24, 24)\n\n-- Generate Turn Around Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, draw.green)\ndraw.transformedimage(approot..\"resources\/MoveLeft.png\", 6, 12, .5, 0)\ndraw.transformedimage(approot..\"resources\/MoveRight.png\", 18, 12, .5, 0)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/TurnAround.png\", 0, 0, 24, 24)\n\n-- Generate Push Pull Arrow\ndraw.setantialias(true)\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, blue3)\ndraw.filltriangle(2, 12, 10, 4, 10, 20, draw.black)\ndraw.fillrect(5, 9, 22, 15, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/PushPull.png\", 0, 0, 24, 24)\n\n-- Generate Push Block Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, blue3)\ndraw.transformedimage(approot..\"resources\/PushPull.png\", 6, 12, .5, math.pi)\ndraw.fillrect(12, 6, 24, 18, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/PushBlock.png\", 0, 0, 24, 24)\n\n-- Generate Pull Block Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, blue3)\ndraw.transformedimage(approot..\"resources\/PushPull.png\", 6, 12, .5, 0)\ndraw.fillrect(12, 6, 24, 18, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/PullBlock.png\", 0, 0, 24, 24)\n\n-- Generate Jump Over Block Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, blue3)\ndraw.transformedimage(approot..\"resources\/PushPull.png\", 12, 6, .5, math.pi)\ndraw.fillrect(12, 12, 24, 24, draw.black)\ndraw.fillrect(4.5, 4.5, 7.5, 18, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/JumpOverBlock.png\", 0, 0, 24, 24)\n\n-- Generate Call Function 1 Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, draw.yellow)\n-- Draw letter F\ndraw.fillrect(2.5, 4.5, 4.5, 19.5, draw.black)\ndraw.fillrect(2.5, 4.5, 11.5, 6.5, draw.black)\ndraw.fillrect(2.5, 11.5, 7.5, 13.5, draw.black)\n-- Draw Number 1\ndraw.fillrect(14.5, 4.5, 19.5, 7.5, draw.black)\ndraw.fillrect(17.5, 4.5, 19.5, 19.5, draw.black)\ndraw.fillrect(14.5, 17.5, 21.5, 19.5, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/Function1.png\", 0, 0, 24, 24)\n\n-- Generate Call Function 1 Command\ndraw.beginframe()\ndraw.clearscreen()\n--draw.fillrect(0, 0, 24, 24, draw.yellow)\n-- Draw letter F\ndraw.fillrect(2.5, 4.5, 4.5, 19.5, draw.black)\ndraw.fillrect(2.5, 4.5, 11.5, 6.5, draw.black)\ndraw.fillrect(2.5, 11.5, 7.5, 13.5, draw.black)\n-- Draw Number 2\ndraw.fillrect(14.5, 4.5, 21.5, 7.5, draw.black)\ndraw.fillrect(19.5, 4.5, 21.5, 11.5, draw.black)\ndraw.fillrect(14.5, 11.5, 21.5, 13.5, draw.black)\ndraw.fillrect(14.5, 13.5, 16.5, 19.5, draw.black)\ndraw.fillrect(14.5, 17.5, 21.5, 19.5, draw.black)\ndraw.endframe()\ndraw.imagesave(approot..\"resources\/Function2.png\", 0, 0, 24, 24)\n\n-- Generate Cubot 1 Front\n"}
|
|