Mothback/data/scripts/entities/decoration.lua

33 lines
606 B
Lua
Raw Normal View History

Decoration = Entity:New(x,y)
function Decoration:New(x,y,animation,lightRange)
local o = Entity:New(x,y)
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 = CreateLight(o.pos.x,o.pos.y,o.lightRange)
end
table.insert(LoadedEntities,o)
o.id = #LoadedEntities
setmetatable(o, self)
self.__index = self
return o
end
function Decoration:HandleAnimation()
self.body:Animate()
self:Draw(self.body)
end
function Decoration:DoPhysics()
end