- [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:
2025-06-01 00:04:30 +02:00
parent c2f7b470bf
commit e285bcd4fd
4 changed files with 37 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ editor={
--selected_tile=3,
brush={w=1,h=1,tiles={3}},
selection=nil,
cx=0,
cy=0,
init=function()
set_update(editor.update)
@@ -16,6 +18,15 @@ editor={
editor.new()
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()
menu.show({ {"NEW MAP", editor.new},
{"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},
{"RESIZE MAP", editor.resize},
{"RELOAD TEXTURES", editor.reload_textures},
{"PLAY FROM HERE", editor.playfromhere},
{"EXIT", main_init},
}, function()editor.paused=false end)
end,
playfromhere=function()
game.startfromeditor(string.sub(mapa.name,1,-5), editor.cx, editor.cy)
end,
reload_textures=function()
surf.free(sprites)
surf.free(objectes)
@@ -175,6 +191,7 @@ editor={
end
local mx,my=mouse.pos()
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
draw.rect(rx-1, ry-1, 10, 10, 10)
if editor.selection then

View File

@@ -30,6 +30,15 @@ game={
--game.init("arq")
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)
if f then flags=f end
@@ -61,6 +70,14 @@ game={
}, game.resume)
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()
local i=1
file = io.open(config.folder().."slot"..i..".txt", "w")
@@ -188,6 +205,8 @@ game={
end
if key.press(key.ESCAPE) then
game.show_menu()
elseif key.press(key.TAB) then
game.show_debug_menu()
end
if sys.beat() then actors.update() end

View File

@@ -1,6 +1,6 @@
levels["arq"]={
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="prohibit2",x=12,y=10,o="d",gfx={x=192,y=48},action=levels.arq.prohibit_action})