sonic-radiance/sonic-radiance.love/scenes/battlesystem/actors/gfx.lua

40 lines
1.1 KiB
Lua

local Parent = require("scenes.battlesystem.actors.movable")
local GFX = Parent:extend()
function GFX:new(world, x, y, z, spritename, creator, blockProcess, tag)
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.tag = tag or ""
if (not utils.string.isEmpty(self.tag)) then
self:setIndexName(self.tag)
end
self.direction = 1
end
function GFX:animationEnded(animation)
core.debug:print("gfx", 'Current animation "' .. animation .. '" have ended, destroying gfx')
if (self.blockProcess) and (self.creator ~= nil) and (self.creator.getSignal ~= nil) then
self.creator:getSignal("gfxEnded")
end
if ((self.creator ~= nil) and (self.creator.choregraphy ~= nil) and (not utils.string.isEmpty(self.tag))) then
self.creator.choregraphy:finishTagAction(self.tag)
end
self:destroy()
end
function GFX:draw()
self:drawSprite(0, -self.z)
end
function GFX:drawShadow()
end
return GFX