Mothback/code/entities/decoration.lua
2022-03-16 19:59:42 -04:00

34 lines
601 B
Lua

Decoration = class(Entity, {
type = "Decoration",
supertype = Entity.type,
display = Animation:new(animation.particle.simple),
})
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)
return o
end
function Decoration:handleAnimation()
self.body:animate()
self:draw(self.body)
end
require "code/entities/decorations/candelabra"