add dialog

This commit is contained in:
Your Name 2026-08-08 00:09:44 -04:00
parent c92c0f6ff7
commit 5413823b26
13 changed files with 390 additions and 32 deletions

View file

@ -15,6 +15,12 @@ require "world_seed"
require "shaders"
require "level_editor/editor"
-- Ink dialogue: ship the pre-parsed book (LÖVE has no lpeg to parse .ink at
-- runtime; the narrator parser degrades to false without it, runtime is fine).
package.path = package.path .. ";libs/narrator/?.lua"
narrator = require "narrator.narrator"
startSignBook = require "stories.start_sign"
function love.load()
globalAssetProperties = {} -- rebuilt from the filesystem (art/ + .meta) by getAllAssets
@ -56,7 +62,7 @@ function love.update(dt)
Input:stopMoveRepeat()
else
local repeatedMove = Input:handler(dt)
if repeatedMove then currentRoom:movePlayer(repeatedMove) end
if repeatedMove and not Dialogue.isOpen() then currentRoom:movePlayer(repeatedMove) end
end
currentRoom:update(dt)
@ -106,9 +112,16 @@ function love.draw()
love.graphics.draw(sideBarCanvas, sideBarBox.x, sideBarBox.y)
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
Dialogue.draw()
end
function love.keypressed(key)
-- Talking to a sign captures input: navigate/choose, don't move the player.
if Dialogue.isOpen() then
Dialogue.keypressed(key)
return
end
if editorView ~= "world" and Input.isPlayerMove(key) then
Input:beginMove(key)
currentRoom:movePlayer(key)