add dialog
This commit is contained in:
parent
c92c0f6ff7
commit
5413823b26
13 changed files with 390 additions and 32 deletions
28
npc.lua
28
npc.lua
|
|
@ -1,14 +1,22 @@
|
|||
npc = class("npc", Entity)
|
||||
require "entity"
|
||||
require "dialogable"
|
||||
|
||||
function npc:initialize(x, y, color, name)
|
||||
-- A dialogable placed in the world. Signs, npcs and artifacts will each be a
|
||||
-- small Entity subclass that includes Dialogable and names its own book; Sign is
|
||||
-- the first. It just picks art + a story — the talking lives in the mixin.
|
||||
Sign = class("Sign", Entity)
|
||||
Sign:include(Dialogable)
|
||||
|
||||
function Sign:initialize(x, y)
|
||||
self.book = startSignBook
|
||||
Entity.initialize(self, {
|
||||
x = x,
|
||||
y = y,
|
||||
color = color,
|
||||
x = x, y = y,
|
||||
color = "red", -- representative only; sprites are per-channel
|
||||
collision = "unmoveable",
|
||||
sprite = sprites.npc[name][color],
|
||||
onBump = function(self)
|
||||
|
||||
end,
|
||||
sprites = {
|
||||
red = loadSprite("art/npc/start_sign_r.png"),
|
||||
green = loadSprite("art/npc/start_sign_g.png"),
|
||||
blue = loadSprite("art/npc/start_sign_b.png"),
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue