now there are spawn objects! now entity spawns are loaded from level! now entity spawns are saved to level!
45 lines
763 B
Lua
45 lines
763 B
Lua
HookAnchor = Entity:new()
|
|
HookAnchor.type = "HookAnchor"
|
|
|
|
function HookAnchor:new(x,y,hook_distance)
|
|
local o = Entity:new(x,y)
|
|
|
|
|
|
o.pos = {x = x, y = y}
|
|
o.hook_distance = hook_distance or 100
|
|
-- animations
|
|
o.body = Animation:new(animation.fairy.flying)
|
|
o:centerOffset(o.body)
|
|
o:createBox(o.body)
|
|
|
|
o:id()
|
|
|
|
setmetatable(o, self)
|
|
self.__index = self
|
|
return o
|
|
end
|
|
|
|
function HookAnchor:handleAnimation()
|
|
self.body:animate()
|
|
self:draw(self.body)
|
|
end
|
|
|
|
function HookAnchor:drawBackground()
|
|
Entity.drawBackground(self)
|
|
love.graphics.setColor(1,1,1,0)
|
|
love.graphics.circle(
|
|
"fill",
|
|
-Camera.pos.x + self.pos.x,
|
|
-Camera.pos.y + self.pos.y,
|
|
self.hook_distance
|
|
)
|
|
end
|
|
|
|
function HookAnchor:doPhysics()
|
|
end
|
|
|
|
|
|
function Fairy:debug()
|
|
Entity.debug(self)
|
|
end
|