- [NEW] Renombrat de una puta vegada el mapa "test" a "arq" (arquitectura), que es la zona que li toca
- [NEW] Nou menúi de debug durant el joc - [NEW] Ara es pot pasar del joc al editor i viceversa in situ.
This commit is contained in:
@@ -9,6 +9,8 @@ editor={
|
|||||||
--selected_tile=3,
|
--selected_tile=3,
|
||||||
brush={w=1,h=1,tiles={3}},
|
brush={w=1,h=1,tiles={3}},
|
||||||
selection=nil,
|
selection=nil,
|
||||||
|
cx=0,
|
||||||
|
cy=0,
|
||||||
|
|
||||||
init=function()
|
init=function()
|
||||||
set_update(editor.update)
|
set_update(editor.update)
|
||||||
@@ -16,6 +18,15 @@ editor={
|
|||||||
editor.new()
|
editor.new()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
editfrom=function()
|
||||||
|
game.paused = nil
|
||||||
|
set_update(editor.update)
|
||||||
|
--editor.show_menu()
|
||||||
|
editor.load(game.level .. ".map")
|
||||||
|
editor.cam.x = game.cam.x
|
||||||
|
editor.cam.y = game.cam.y
|
||||||
|
end,
|
||||||
|
|
||||||
show_menu=function()
|
show_menu=function()
|
||||||
menu.show({ {"NEW MAP", editor.new},
|
menu.show({ {"NEW MAP", editor.new},
|
||||||
{"LOAD MAP", function() fileselect.show("FILE TO LOAD:",editor.load, ".map") end},
|
{"LOAD MAP", function() fileselect.show("FILE TO LOAD:",editor.load, ".map") end},
|
||||||
@@ -23,10 +34,15 @@ editor={
|
|||||||
{editor.editing_front_layer and "DISABLE FRONT LAYER" or "ENABLE FRONT LAYER", editor.toggle_front_layer},
|
{editor.editing_front_layer and "DISABLE FRONT LAYER" or "ENABLE FRONT LAYER", editor.toggle_front_layer},
|
||||||
{"RESIZE MAP", editor.resize},
|
{"RESIZE MAP", editor.resize},
|
||||||
{"RELOAD TEXTURES", editor.reload_textures},
|
{"RELOAD TEXTURES", editor.reload_textures},
|
||||||
|
{"PLAY FROM HERE", editor.playfromhere},
|
||||||
{"EXIT", main_init},
|
{"EXIT", main_init},
|
||||||
}, function()editor.paused=false end)
|
}, function()editor.paused=false end)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
playfromhere=function()
|
||||||
|
game.startfromeditor(string.sub(mapa.name,1,-5), editor.cx, editor.cy)
|
||||||
|
end,
|
||||||
|
|
||||||
reload_textures=function()
|
reload_textures=function()
|
||||||
surf.free(sprites)
|
surf.free(sprites)
|
||||||
surf.free(objectes)
|
surf.free(objectes)
|
||||||
@@ -175,6 +191,7 @@ editor={
|
|||||||
end
|
end
|
||||||
local mx,my=mouse.pos()
|
local mx,my=mouse.pos()
|
||||||
local tx,ty=(mx+editor.cam.x)>>3,(my+editor.cam.y)>>3
|
local tx,ty=(mx+editor.cam.x)>>3,(my+editor.cam.y)>>3
|
||||||
|
editor.cx, editor.cy = tx, ty
|
||||||
local rx,ry=tx<<3,ty<<3
|
local rx,ry=tx<<3,ty<<3
|
||||||
draw.rect(rx-1, ry-1, 10, 10, 10)
|
draw.rect(rx-1, ry-1, 10, 10, 10)
|
||||||
if editor.selection then
|
if editor.selection then
|
||||||
|
|||||||
@@ -30,6 +30,15 @@ game={
|
|||||||
--game.init("arq")
|
--game.init("arq")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
startfromeditor=function(s_level, s_x, s_y)
|
||||||
|
flags={}
|
||||||
|
objects.list={}
|
||||||
|
actors.main={name="jailer",x=s_x,y=s_y,o="d",gfx={x=32,y=0},level=s_level}
|
||||||
|
game.init(s_level)
|
||||||
|
--actors.main={name="jailer",x=8,y=12,o="l",gfx={x=32,y=0},level="arq"}
|
||||||
|
--game.init("arq")
|
||||||
|
end,
|
||||||
|
|
||||||
init=function(levelname,f,objs)
|
init=function(levelname,f,objs)
|
||||||
|
|
||||||
if f then flags=f end
|
if f then flags=f end
|
||||||
@@ -61,6 +70,14 @@ game={
|
|||||||
}, game.resume)
|
}, game.resume)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
show_debug_menu=function()
|
||||||
|
game.pause()
|
||||||
|
menu.show({ {"EDIT FROM HERE", editor.editfrom},
|
||||||
|
{"CARREGAR PARTIDA", game.load},
|
||||||
|
{"EIXIR", main_init},
|
||||||
|
}, game.resume)
|
||||||
|
end,
|
||||||
|
|
||||||
save=function()
|
save=function()
|
||||||
local i=1
|
local i=1
|
||||||
file = io.open(config.folder().."slot"..i..".txt", "w")
|
file = io.open(config.folder().."slot"..i..".txt", "w")
|
||||||
@@ -188,6 +205,8 @@ game={
|
|||||||
end
|
end
|
||||||
if key.press(key.ESCAPE) then
|
if key.press(key.ESCAPE) then
|
||||||
game.show_menu()
|
game.show_menu()
|
||||||
|
elseif key.press(key.TAB) then
|
||||||
|
game.show_debug_menu()
|
||||||
end
|
end
|
||||||
|
|
||||||
if sys.beat() then actors.update() end
|
if sys.beat() then actors.update() end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
levels["arq"]={
|
levels["arq"]={
|
||||||
load=function()
|
load=function()
|
||||||
mapa.load("test.map")
|
mapa.load("arq.map")
|
||||||
|
|
||||||
actors.add({name="prohibit1",x=6,y=10,o="d",gfx={x=192,y=48},action=levels.arq.prohibit_action})
|
actors.add({name="prohibit1",x=6,y=10,o="d",gfx={x=192,y=48},action=levels.arq.prohibit_action})
|
||||||
actors.add({name="prohibit2",x=12,y=10,o="d",gfx={x=192,y=48},action=levels.arq.prohibit_action})
|
actors.add({name="prohibit2",x=12,y=10,o="d",gfx={x=192,y=48},action=levels.arq.prohibit_action})
|
||||||
|
|||||||
Reference in New Issue
Block a user