Mothback/code/entities/decoration.lua
2022-03-17 00:39:47 +01:00

35 lines
666 B
Lua

Decoration = {}
Decoration.type = "Decoration"
Decoration.supertype = Entity.type
Decoration.display = Animation:new(animation.particle.simple)
setmetatable(Decoration, Entity)
function Decoration:new(x,y,animation,light_data)
local o = Entity:new(x,y)
o.pos = {x = x, y = y}
if animation then
o.body = Animation:new(animation)
o:centerOffset(o.body)
o:createBox(o.body)
end
if light_data then
o.light = Light:new(o.pos.x,o.pos.y,light_data)
end
o:id()
setmetatable(o, self)
self.__index = self
return o
end
function Decoration:handleAnimation()
self.body:animate()
self:draw(self.body)
end
require "code/entities/decorations/candelabra"