lul
This commit is contained in:
40
Assets/lua/npc.lua
Normal file
40
Assets/lua/npc.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
-- ============================================================================
|
||||
-- npc.lua - NPC with multi-line dialogue
|
||||
-- ============================================================================
|
||||
-- Tests: onInteract, onButtonPress, Controls, UI text,
|
||||
-- scene-level dialogue system, Input constants
|
||||
|
||||
local talked = false
|
||||
|
||||
function onCreate(self)
|
||||
talked = false
|
||||
end
|
||||
|
||||
function onInteract(self)
|
||||
if isInDialogue() then return end
|
||||
|
||||
if not talked then
|
||||
talked = true
|
||||
startDialogue({
|
||||
"Hello, traveler!",
|
||||
"Welcome to the test scene.",
|
||||
"There are collectibles, a door,",
|
||||
"triggers, and a portal here.",
|
||||
"Press CROSS to advance dialogue.",
|
||||
"Good luck exploring!"
|
||||
})
|
||||
else
|
||||
startDialogue({
|
||||
"You again?",
|
||||
"Go find the collectibles!",
|
||||
"There should be three of them."
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function onButtonPress(self, button)
|
||||
if not isInDialogue() then return end
|
||||
if button == Input.CROSS then
|
||||
advanceDialogue()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user