From ca3bf9ea7e7a8177f95f1eda41cef046bbebfcdf Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 29 Jul 2019 09:02:30 +0200 Subject: [PATCH] chore(gfx): port gfx actors to the new system --- .../core/modules/world/actors/gfx2D.lua | 11 +++-------- .../core/modules/world/actors/gfx3D.lua | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/sonic-radiance.love/core/modules/world/actors/gfx2D.lua b/sonic-radiance.love/core/modules/world/actors/gfx2D.lua index 9f3857e..900654c 100644 --- a/sonic-radiance.love/core/modules/world/actors/gfx2D.lua +++ b/sonic-radiance.love/core/modules/world/actors/gfx2D.lua @@ -31,16 +31,11 @@ function GFX:new(world, x, y, spritename) GFX.super.new(self, world, "gfx", x - (width/2), y - (height/2), width, height) self:setSprite(spritename) self:cloneSprite() - - local duration = self.sprite.clone:getAnimationDuration() - self:addTimer("destroy", duration) - self.depth = -100 end -function GFX:timerResponse(name) - if (name == "destroy") then - self:destroy() - end +function GFX:animationEnded(animation) + core.debug:print("gfx2D", 'Current animation "' .. animation .. '" have ended, destroying gfx') + self:destroy() end return GFX diff --git a/sonic-radiance.love/core/modules/world/actors/gfx3D.lua b/sonic-radiance.love/core/modules/world/actors/gfx3D.lua index 0111f22..bf26f56 100644 --- a/sonic-radiance.love/core/modules/world/actors/gfx3D.lua +++ b/sonic-radiance.love/core/modules/world/actors/gfx3D.lua @@ -31,16 +31,11 @@ function GFX:new(world, x, y, z, spritename) GFX.super.new(self, world, "gfx", x - (width/2), y - (width/2), z - (height/2), width, width, height) self:setSprite(spritename) self:cloneSprite() - - local duration = self.sprite.clone:getAnimationDuration() - self:addTimer("destroy", duration) - self.depth = -100 end -function GFX:timerResponse(name) - if (name == "destroy") then - self:destroy() - end +function GFX:animationEnded(animation) + core.debug:print("gfx3D", 'Current animation "' .. animation .. '" have ended, destroying gfx') + self:destroy() end return GFX