Mothback/code/entities/decoration.lua

35 lines
622 B
Lua
Raw Normal View History

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