diff --git a/editor.sh b/editor.sh new file mode 100755 index 0000000..39edbd2 --- /dev/null +++ b/editor.sh @@ -0,0 +1,3 @@ +cd ../up-editor/ +love . +cd ../platformer diff --git a/levels.lua b/levels.lua index 052e6c6..24eb741 100644 --- a/levels.lua +++ b/levels.lua @@ -1,143 +1,30 @@ --- . air --- 0 solid --- - placeholder tile --- v spike --- ^ elevator --- ~ ice --- # glue --- j jump upgrade --- c coin --- --- level id format : YYXX with YY and XX being the Y and X position on the map - -levels = {[5050] = [[ ----------------------------- --0000000....000000000000000- --0000000....000000000000000- --00000000....00000.........- --00000000..................- --00000000...........0000000- --0000000000.....00000000000- --0000000000.....00000000000- --00000000...........0000000- --00000..............0000000- --.............0000000000000- --..........0000000000000000- --00000000000000000000000000- --00000000000000000000000000- --00000000000000000000000000- --00000000000000000000000000- ----------------------------- -]], -[5049] = [[ ----------------------------- --00000000000000000000000000- --00000000000000000000000000- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --........................00- --........................00- --00........................- --000.......................- --000.0000000000000000000000- --..........0000000000000000- --00000000..0000000000000000- --00000000..0000000000000000- ----------------------------- -]], -[5048] = [[ ----------------------------- --00000000000000000000000000- --00000000000000000000000000- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00........................- --00........................- --00.................0000000- --00.................0000000- --00.................0000000- --00.................00..c..- --000000000000000000000.0000- --000000000000000000000.0000- ----------------------------- -]], -[5148] = [[ ----------------------------- --000000000000000000000.0000- --000000000000000000000.....- --00..................000000- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00000000000000000000000000- --00000000000000000000000000- ----------------------------- -]], -[5149] = [[ ----------------------------- --00000000..0000000000000000- --...00000..0000000000000000- --00......................00- --00......................00- --0000000000000000..vv000000- --0000000000000000...0000000- --00000......0000.......0000- --000.........00....00...000- --00^.........00.........000- --00^.j................00000- --00^....................000- --00^.........0^.........000- --0000^.......0^.......00000- --00000000000000000000000000- --00000000000000000000000000- ----------------------------- -]], -[0] = [[ ----------------------------- --00000000000000000000000000- --00000000000000000000000000- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00......................00- --00000000000000000000000000- --00000000000000000000000000- ----------------------------- -]], -} - to_write = "" ---remove all "\n" from level strings current = 0 -for i, v in pairs(levels) do - v = string.gsub(v, "\n", "") - to_write = to_write.." case "..i..":\n memcpy(level, \""..v.."\", "..#v..");\n" - if string.find(v, 'c') then - to_write = to_write.." *coin_id = "..current..";\n" +for i = 0, 9999, 1 do + file = io.open("../up-editor/screens/"..i..".scr") + if file then + file_content = file:read() + formated_file = "" + for j = 1, #file_content, 1 do + if j == 1 then + formated_file = formated_file.."-----------------------------" + end + formated_file = formated_file..file_content:sub(j, j) + if j % 26 == 0 then formated_file = formated_file.."--" end + if j == 390 then + formated_file = formated_file.."---------------------------" + end + end + file:close() + to_write = to_write.." case "..i..":\n memcpy(level, \"".. + formated_file.."\", "..#formated_file..");\n" + if string.find(file_content, 'c') then + to_write = to_write.." *coin_id = "..current..";\n" + end + to_write = to_write.." break;\n" + current = current + 1 end - to_write = to_write.." break;\n" - current = current + 1 end --finish and write diff --git a/platform.g3a b/platform.g3a index 2290264..38ddbf0 100644 Binary files a/platform.g3a and b/platform.g3a differ