gfx: autoload gfxes when they are created
This commit is contained in:
parent
0acce516c8
commit
603d61a1fc
15 changed files with 27 additions and 20 deletions
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
@ -15,7 +15,7 @@ return {
|
||||||
choregraphy = { -- the main attack choregraphy
|
choregraphy = { -- the main attack choregraphy
|
||||||
{"goTo3D", "none", "actor", "target", -0.4, 0, 0, 0.5, true},
|
{"goTo3D", "none", "actor", "target", -0.4, 0, 0, 0.5, true},
|
||||||
{"sendDamage", "none", 120, "basic", "none", false},
|
{"sendDamage", "none", 120, "basic", "none", false},
|
||||||
{'addGFX', "sentDamage", 'hitGFX', "target", -0.4, 0, 0, true, false},
|
{'addGFX', "sentDamage", 'hit1', "target", -0.4, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'jumpBack', "none", "actor", 4, 8, true},
|
{'jumpBack', "none", "actor", 4, 8, true},
|
||||||
{"wait", "none", 0.1},
|
{"wait", "none", 0.1},
|
||||||
|
|
|
@ -21,7 +21,8 @@ return {
|
||||||
{'playSFX', "none", 'spinrelease'},
|
{'playSFX', "none", 'spinrelease'},
|
||||||
{"waitFor", "none", "actionFinished:playerMove"},
|
{"waitFor", "none", "actionFinished:playerMove"},
|
||||||
{"sendDamage", "none", 100, "basic", "none", false},
|
{"sendDamage", "none", 100, "basic", "none", false},
|
||||||
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 0, true, false},
|
{"sendStatus", "none", "vulnerable", 5, true},
|
||||||
|
{'addGFX', "sentDamage", 'hit1', "target", 0, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'jumpBack', "none", "actor", 4, 8, true},
|
{'jumpBack', "none", "actor", 4, 8, true},
|
||||||
{"wait", "none", 0.1},
|
{"wait", "none", 0.1},
|
||||||
|
|
|
@ -23,21 +23,21 @@ return {
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", "actor", 'hit1start', true},
|
{'setAnimation', "none", "actor", 'hit1start', true},
|
||||||
{'sendDamage', "none", 40, "basic", "none", false},
|
{'sendDamage', "none", 40, "basic", "none", false},
|
||||||
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
|
{'addGFX',"sentDamage", 'hit1', "actor", 0.75, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'setAnimation', "none", "actor", 'hit1end', true},
|
{'setAnimation', "none", "actor", 'hit1end', true},
|
||||||
|
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", "actor", 'hit2start', true},
|
{'setAnimation', "none", "actor", 'hit2start', true},
|
||||||
{'sendDamage', "none", 40, "basic", "none", false},
|
{'sendDamage', "none", 40, "basic", "none", false},
|
||||||
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
|
{'addGFX',"sentDamage", 'hit1', "actor", 0.75, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'setAnimation', "none", "actor", 'hit2end', true},
|
{'setAnimation', "none", "actor", 'hit2end', true},
|
||||||
|
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", "actor", 'hit3start', true},
|
{'setAnimation', "none", "actor", 'hit3start', true},
|
||||||
{'sendDamage', "none", 40, "basic", "none", false},
|
{'sendDamage', "none", 40, "basic", "none", false},
|
||||||
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
|
{'addGFX',"sentDamage", 'hit1', "actor", 0.75, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'setAnimation', "none", "actor", 'hit3end', true},
|
{'setAnimation', "none", "actor", 'hit3end', true},
|
||||||
{'setAnimation', "none", "actor", 'idle', false},
|
{'setAnimation', "none", "actor", 'idle', false},
|
||||||
|
@ -46,7 +46,7 @@ return {
|
||||||
{"setAnimation", "qteSuccess:1", "actor", "upper", false},
|
{"setAnimation", "qteSuccess:1", "actor", "upper", false},
|
||||||
{"waitFor", "qteSuccess:1", "haveFrameSignal:hitconnect"},
|
{"waitFor", "qteSuccess:1", "haveFrameSignal:hitconnect"},
|
||||||
{'sendDamage', "qteSuccess:1", 75, "basic", "none", false},
|
{'sendDamage', "qteSuccess:1", 75, "basic", "none", false},
|
||||||
{'addGFX', {"qteSuccess:1", "sentDamage"}, 'hitGFX', "actor", 0.75, 0, 0, true, false},
|
{'addGFX', {"qteSuccess:1", "sentDamage"}, 'hit1', "actor", 0.75, 0, 0, true, false},
|
||||||
{'playSFX', {"qteSuccess:1", "sentDamage"}, 'hitconnect'},
|
{'playSFX', {"qteSuccess:1", "sentDamage"}, 'hitconnect'},
|
||||||
|
|
||||||
{'wait', "none", 0.2},
|
{'wait', "none", 0.2},
|
||||||
|
|
|
@ -21,12 +21,12 @@ return {
|
||||||
{"taggedAction", "hommingQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.4}, "target", false}},
|
{"taggedAction", "hommingQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.4}, "target", false}},
|
||||||
{"waitFor", "none", "actionFinished:hommingQte"},
|
{"waitFor", "none", "actionFinished:hommingQte"},
|
||||||
{"taggedAction", "dashToEnnemy", {"goTo3D", "none", "actor", "target", 0, 0, 8, 0.2, false}},
|
{"taggedAction", "dashToEnnemy", {"goTo3D", "none", "actor", "target", 0, 0, 8, 0.2, false}},
|
||||||
{'addGFX', "none", 'hommingGFX', "actor", 0, 0, -4, true, false},
|
{'addGFX', "none", 'homming', "actor", 0, 0, -4, true, false},
|
||||||
{"setAnimation", "none", "actor", "spin", false},
|
{"setAnimation", "none", "actor", "spin", false},
|
||||||
{'playSFX', "none", 'spinrelease'},
|
{'playSFX', "none", 'spinrelease'},
|
||||||
{"waitFor", "none", "actionFinished:dashToEnnemy"},
|
{"waitFor", "none", "actionFinished:dashToEnnemy"},
|
||||||
{"sendDamage", "none", 30, "aerial", "none", false},
|
{"sendDamage", "none", 30, "aerial", "none", false},
|
||||||
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 4, true, false},
|
{'addGFX', "sentDamage", 'hit1', "target", 0, 0, 4, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{"taggedAction", "jumpingHero", {'jumpBack', "none", "actor", 5.5, 5.5, false}},
|
{"taggedAction", "jumpingHero", {'jumpBack', "none", "actor", 5.5, 5.5, false}},
|
||||||
{"wait", "none", 0.1},
|
{"wait", "none", 0.1},
|
||||||
|
|
|
@ -15,7 +15,7 @@ return {
|
||||||
{'playSFX', "none", 'spinrelease'},
|
{'playSFX', "none", 'spinrelease'},
|
||||||
{"goTo", "none", "actor", "target", 0, 0, 0.3, true},
|
{"goTo", "none", "actor", "target", 0, 0, 0.3, true},
|
||||||
{"sendDamage", "none", 120, "basic", "none", false},
|
{"sendDamage", "none", 120, "basic", "none", false},
|
||||||
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 0, true, false},
|
{'addGFX', "sentDamage", 'hit1', "target", 0, 0, 0, true, false},
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'jumpBack', "none", "actor", 4, 8, true},
|
{'jumpBack', "none", "actor", 4, 8, true},
|
||||||
{"wait", "none", 0.1},
|
{"wait", "none", 0.1},
|
||||||
|
|
|
@ -38,7 +38,7 @@ end
|
||||||
|
|
||||||
function Ennemy:die()
|
function Ennemy:die()
|
||||||
self.assets.sfx["badnicsBoom"]:play()
|
self.assets.sfx["badnicsBoom"]:play()
|
||||||
self.world.obj.GFX(self.world, self.x, self.y, self.z, "boomGFX", self, false)
|
self.world.obj.GFX(self.world, self.x, self.y, self.z, "boom1", self, false)
|
||||||
self:destroy()
|
self:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
local Parent = require("scenes.battlesystem.actors.movable")
|
local Parent = require("scenes.battlesystem.actors.movable")
|
||||||
local GFX = Parent:extend()
|
local GFX = Parent:extend()
|
||||||
|
local GFX_DIRECTORY = "assets/sprites/gfx/"
|
||||||
|
|
||||||
function GFX:new(world, x, y, z, spritename, creator, blockProcess, tag)
|
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)
|
GFX.super.new(self, world, x, y, z)
|
||||||
self:setSprite(spritename, width/2, height, true)
|
self:loadAnimation(spritename)
|
||||||
self:cloneSprite()
|
|
||||||
self.creator = creator
|
self.creator = creator
|
||||||
self.blockProcess = blockProcess or false
|
self.blockProcess = blockProcess or false
|
||||||
self.tag = tag or ""
|
self.tag = tag or ""
|
||||||
|
@ -18,6 +17,15 @@ function GFX:new(world, x, y, z, spritename, creator, blockProcess, tag)
|
||||||
self.direction = 1
|
self.direction = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GFX:loadAnimation(spritename)
|
||||||
|
if self.world.assets.sprites[spritename] == nil then
|
||||||
|
self.world.assets:addSprite(spritename, GFX_DIRECTORY .. spritename)
|
||||||
|
end
|
||||||
|
local width, height = self.world.assets.sprites[spritename]:getDimensions()
|
||||||
|
self:setSprite(spritename, width/2, height, true)
|
||||||
|
self:cloneSprite()
|
||||||
|
end
|
||||||
|
|
||||||
function GFX:animationEnded(animation)
|
function GFX:animationEnded(animation)
|
||||||
core.debug:print("gfx", 'Current animation "' .. animation .. '" have ended, destroying gfx')
|
core.debug:print("gfx", 'Current animation "' .. animation .. '" have ended, destroying gfx')
|
||||||
if (self.blockProcess) and (self.creator ~= nil) and (self.creator.getSignal ~= nil) then
|
if (self.blockProcess) and (self.creator ~= nil) and (self.creator.getSignal ~= nil) then
|
||||||
|
|
|
@ -8,9 +8,7 @@ return {
|
||||||
{"qtebtn", "assets/gui/qtebtn"}
|
{"qtebtn", "assets/gui/qtebtn"}
|
||||||
},
|
},
|
||||||
["sprites"] = {
|
["sprites"] = {
|
||||||
{"cursorground", "assets/gui/cursor/ground"},
|
{"cursorground", "assets/gui/cursor/ground"}
|
||||||
{"hitGFX", "assets/sprites/gfx/hit"},
|
|
||||||
{"boomGFX", "assets/sprites/gfx/boom1"},
|
|
||||||
},
|
},
|
||||||
["textures"] = {
|
["textures"] = {
|
||||||
{"menucursor", "assets/gui/cursor-menulist.png"},
|
{"menucursor", "assets/gui/cursor-menulist.png"},
|
||||||
|
|
|
@ -7,7 +7,7 @@ return {
|
||||||
},
|
},
|
||||||
["sprites"] = {
|
["sprites"] = {
|
||||||
{"cursorground", "assets/gui/cursor/ground"},
|
{"cursorground", "assets/gui/cursor/ground"},
|
||||||
{"hitGFX", "assets/sprites/gfx/hit"},
|
{"hitGFX", "assets/sprites/gfx/hit1"},
|
||||||
},
|
},
|
||||||
["textures"] = {
|
["textures"] = {
|
||||||
{"menucursor", "assets/gui/cursor-menulist.png"},
|
{"menucursor", "assets/gui/cursor-menulist.png"},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
return {
|
return {
|
||||||
["sprites"] = {
|
["sprites"] = {
|
||||||
{"cursorground", "assets/gui/cursor/ground"},
|
{"cursorground", "assets/gui/cursor/ground"},
|
||||||
{"hitGFX", "assets/sprites/gfx/hit"},
|
{"hitGFX", "assets/sprites/gfx/hit1"},
|
||||||
},
|
},
|
||||||
["textures"] = {
|
["textures"] = {
|
||||||
{"background", "assets/artworks/back.png"}
|
{"background", "assets/artworks/back.png"}
|
||||||
|
|
|
@ -7,7 +7,7 @@ return {
|
||||||
},
|
},
|
||||||
["sprites"] = {
|
["sprites"] = {
|
||||||
{"cursorground", "assets/gui/cursor/ground"},
|
{"cursorground", "assets/gui/cursor/ground"},
|
||||||
{"hitGFX", "assets/sprites/gfx/hit"},
|
{"hitGFX", "assets/sprites/gfx/hit1"},
|
||||||
{"encounter", "assets/sprites/encounter"},
|
{"encounter", "assets/sprites/encounter"},
|
||||||
{"punch", "assets/sprites/gfx/punch"},
|
{"punch", "assets/sprites/gfx/punch"},
|
||||||
{"dash", "assets/sprites/gfx/dash"},
|
{"dash", "assets/sprites/gfx/dash"},
|
||||||
|
|
Loading…
Reference in a new issue