- [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