34 lines
595 B
Lua
34 lines
595 B
Lua
Decoration = Entity:new()
|
|
Decoration.type = "Decoration"
|
|
Decoration.display = nil
|
|
|
|
function Decoration:new(x,y,animation,light_radius)
|
|
local o = Entity:new(x,y)
|
|
|
|
o.pos = {x = x, y = y}
|
|
|
|
-- animations
|
|
o.body = Animation:new(animation)
|
|
o:centerOffset(o.body)
|
|
o:createBox(o.body)
|
|
|
|
if light_radius ~= nil then
|
|
o.light_radius = light_radius
|
|
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius)
|
|
end
|
|
|
|
o:id()
|
|
|
|
setmetatable(o, self)
|
|
self.__index = self
|
|
return o
|
|
end
|
|
|
|
function Decoration:handleAnimation()
|
|
self.body:animate()
|
|
self:draw(self.body)
|
|
end
|
|
|
|
function Decoration:doPhysics()
|
|
end
|