Add world-level movement and seam rendering

This commit is contained in:
Your Name 2026-08-11 21:26:19 -04:00
parent a60f46d585
commit 1965e548b4
3 changed files with 386 additions and 27 deletions

View file

@ -35,6 +35,9 @@ function love.load()
_initAccessibility()
gameWorld = World:new()
_initLevelEditor()
-- getAllAssets runs in _initLevelEditor; deserialize the world only after
-- its asset metadata exists, otherwise every non-player object is skipped.
gameWorld:loadLevels()
_initCanvases()
@ -43,10 +46,14 @@ function love.load()
-- Resume the game: prefer the runtime autosave so the last saved position is
-- restored, falling back to the authored source level. Editor room-opens go
-- through their own (source-only) load path, so this only affects resume.
currentRoom = Room:new{
name = gameWorld.lastRoom or "start",
runtime = true
}
local initialRoom = gameWorld.lastRoom or "start"
-- Preserve the old resume behavior for the active room while the rest of the
-- world comes from the authored level files.
currentRoom = Room:new{name = initialRoom, runtime = true}
if gameWorld.levels[initialRoom] then
gameWorld.levels[initialRoom] = currentRoom
gameWorld:rebuildCollision()
end
gameWorld:setLastRoom(currentRoom.name)
setEditorRoomName(currentRoom.name)
@ -69,7 +76,7 @@ function love.update(dt)
Input:stopMoveRepeat()
else
local repeatedMove = Input:handler(dt)
if repeatedMove and not Dialogue.isOpen() then currentRoom:movePlayer(repeatedMove) end
if repeatedMove and not Dialogue.isOpen() then gameWorld:movePlayer(currentRoom, repeatedMove) end
end
currentRoom:update(dt)
@ -164,10 +171,10 @@ function love.keypressed(key)
if editorView ~= "world" and Input.isPlayerMove(key) then
Input:beginMove(key)
currentRoom:movePlayer(key)
gameWorld:movePlayer(currentRoom, key)
elseif editorView ~= "world" and Input.isPlayerSwitch(key) then
local c = Input.playerColor(key)
currentRoom:switchPlayerColor(c)
gameWorld:switchPlayerColor(currentRoom, c)
end
-- if key == "w" then