chroma_solstice/npc.lua
2026-08-11 20:10:03 -04:00

40 lines
1.1 KiB
Lua

require "entity"
require "dialogable"
-- 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 = "red", -- representative only; sprites are per-channel
collision = "unmoveable",
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
Jorge = class("Jorge", Entity)
Jorge:include(Dialogable)
function Jorge:initialize(x, y)
self.book = jorgeBook
self.saveClass = "jorge"
Entity.initialize(self, {
x = x, y = y,
color = "red",
collision = "unmoveable",
sprites = {
red = loadSprite("art/npc/jorge_r.png"),
green = loadSprite("art/npc/jorge_g.png"),
blue = loadSprite("art/npc/jorge_b.png"),
},
})
end