Mothback/code/entities/decoration.lua

35 lines
645 B
Lua

Decoration = Entity:New(x,y)
function Decoration:New(x,y,animation,lightRange)
local o = Entity:New(x,y)
o.type = "decoration"
o.pos = {x = x, y = y}
-- animations
o.body = Animation:New(animation)
o:centerOffset(o.body)
o:getBoundingBox(o.body)
if lightRange ~= nil then
o.lightRange = lightRange
o.light = Light:New(o.pos.x,o.pos.y,o.lightRange)
end
table.insert(LoadedObjects.Entities,o)
o.id = #LoadedObjects.Entities
setmetatable(o, self)
self.__index = self
return o
end
function Decoration:HandleAnimation()
self.body:Animate()
self:Draw(self.body)
end
function Decoration:DoPhysics()
end