2019-08-18 19:02:14 +02:00
|
|
|
local Parent = require("scenes.battlesystem.actors.parent")
|
|
|
|
local GFX = Parent:extend()
|
|
|
|
|
|
|
|
function GFX:new(world, x, y, z, spritename, creator, blockProcess)
|
|
|
|
local width, height = world.assets.sprites[spritename]:getDimensions()
|
|
|
|
|
|
|
|
GFX.super.new(self, world, x, y, z)
|
|
|
|
self:setSprite(spritename, width/2, height, true)
|
|
|
|
self:cloneSprite()
|
|
|
|
self.creator = creator
|
|
|
|
self.blockProcess = blockProcess or false
|
|
|
|
|
|
|
|
self.direction = 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function GFX:animationEnded(animation)
|
|
|
|
core.debug:print("gfx", 'Current animation "' .. animation .. '" have ended, destroying gfx')
|
2020-05-02 13:01:43 +02:00
|
|
|
if (self.blockProcess) and (self.creator ~= nil) and (self.creator.getSignal ~= nil) then
|
|
|
|
self.creator:getSignal("gfxEnded")
|
|
|
|
end
|
2019-08-18 19:02:14 +02:00
|
|
|
self:destroy()
|
|
|
|
end
|
|
|
|
|
|
|
|
function GFX:draw()
|
|
|
|
self:drawSprite()
|
|
|
|
end
|
|
|
|
|
|
|
|
function GFX:drawShadow()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return GFX
|