feat: add actor targeting for choregraphy movement

This commit is contained in:
Kazhnuz 2021-08-07 13:36:13 +02:00
parent dac38cb49e
commit a67d1f0824
16 changed files with 112 additions and 84 deletions

View file

@ -13,13 +13,13 @@ return {
isSpecial = false, isSpecial = false,
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"goTo3D", "none", "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", 'hitGFX', "target", -0.4, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true}, {'jumpBack', "none", "actor", 4, 8, true},
{"wait", "none", 0.1}, {"wait", "none", 0.1},
{'goTo3D', "none", "start", 0, 0, 0, 0.3, true}, {'goTo3D', "none", "actor", "start", 0, 0, 0, 0.3, true},
}, },
onContact = { -- if the attack move and touch multiple ennemies, you can add onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -14,20 +14,20 @@ return {
targetEnnemies = true, targetEnnemies = true,
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{"taggedAction", "playerMove", {"goTo", "none", "target", 0, 0, 0.6, false}}, {"taggedAction", "playerMove", {"goTo", "none", "actor", "target", 0, 0, 0.6, false}},
{"wait", "none", 0.3}, {"wait", "none", 0.3},
{"setAnimation", "none", "spin", false}, {"setAnimation", "none", "actor", "spin", false},
{'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}, {'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true}, {'jumpBack', "none", "actor", 4, 8, true},
{"wait", "none", 0.1}, {"wait", "none", 0.1},
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true}, {'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
}, },
onContact = { -- if the attack move and touch multiple ennemies, you can add onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -14,45 +14,45 @@ return {
targetEnnemies = true, targetEnnemies = true,
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "target", -1, 0, 0.3, false}, {'goTo', "none", "actor", "target", -1, 0, 0.3, false},
{"wait", "none", 0.15}, {"wait", "none", 0.15},
{"taggedAction", "comboQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}, {"A", 1}, {"B", 1}}, 0.5}, "target", false}}, {"taggedAction", "comboQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}, {"A", 1}, {"B", 1}}, 0.5}, "target", false}},
{"wait", "none", 0.15}, {"wait", "none", 0.15},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", '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", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit1end', true}, {'setAnimation', "none", "actor", 'hit1end', true},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", '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", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit2end', true}, {'setAnimation', "none", "actor", 'hit2end', true},
{'playSFX', "none", 'hit'}, {'playSFX', "none", 'hit'},
{'setAnimation', "none", '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", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit3end', true}, {'setAnimation', "none", "actor", 'hit3end', true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
{'waitFor', "none", "actionFinished:comboQte"}, {'waitFor', "none", "actionFinished:comboQte"},
{"setAnimation", "qteSuccess:1", "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"}, 'hitGFX', "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},
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true}, {'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
}, },
onContact = { -- if the attack move and touch multiple ennemies, you can add onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -14,21 +14,21 @@ return {
targetEnnemies = true, targetEnnemies = true,
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 5, 0, 0.5, true}, {'goTo', "none", "actor", "start", 5, 0, 0.5, true},
{"taggedAction", "jumpingHero", {'jump', "none", 5.5, true, false}}, {"taggedAction", "jumpingHero", {'jump', "none", "actor", 5.5, true, false}},
{"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", "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", 'hommingGFX', "actor", 0, 0, -4, true, false},
{"setAnimation", "none", "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", 'hitGFX', "target", 0, 0, 4, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{"taggedAction", "jumpingHero", {'jumpBack', "none", 5.5, 5.5, false}}, {"taggedAction", "jumpingHero", {'jumpBack', "none", "actor", 5.5, 5.5, false}},
{"wait", "none", 0.1}, {"wait", "none", 0.1},
{"setCounter", "none", "spinSpam", 1, true}, {"setCounter", "none", "spinSpam", 1, true},
@ -37,9 +37,9 @@ return {
{"skipTo", {"counter:spinSpam:lt:5", "qteSuccess"}, "dashToEnnemy"}, {"skipTo", {"counter:spinSpam:lt:5", "qteSuccess"}, "dashToEnnemy"},
{"waitFor", "none", "actionFinished:jumpingHero"}, {"waitFor", "none", "actionFinished:jumpingHero"},
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true}, {'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
}, },
onContact = { -- if the attack move and touch multiple ennemies, you can add onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -6,21 +6,21 @@ return {
targetNumber = 1, -- 0 for targeting all ennemies targetNumber = 1, -- 0 for targeting all ennemies
targetEnnemies = true, targetEnnemies = true,
choregraphy = { choregraphy = {
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 2, 0, 0.5, true}, {'goTo', "none", "actor", "start", 2, 0, 0.5, true},
{"setAnimation", "none", "spindash", false}, {"setAnimation", "none", "actor", "spindash", false},
{'playSFX', "none", 'spincharge'}, {'playSFX', "none", 'spincharge'},
{"wait", "none", 1}, {"wait", "none", 1},
{"setAnimation", "none", "spin", false}, {"setAnimation", "none", "actor", "spin", false},
{'playSFX', "none", 'spinrelease'}, {'playSFX', "none", 'spinrelease'},
{"goTo", "none", "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", 'hitGFX', "target", 0, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'}, {'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true}, {'jumpBack', "none", "actor", 4, 8, true},
{"wait", "none", 0.1}, {"wait", "none", 0.1},
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true}, {'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
} }
} }

View file

@ -12,16 +12,16 @@ return {
targetNumber = 1, -- 0 for targeting all ennemies targetNumber = 1, -- 0 for targeting all ennemies
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 2, 0, 0.5, true}, {'goTo', "none", "actor", "start", 2, 0, 0.5, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
{'wait', "none", 0.4}, {'wait', "none", 0.4},
{'useItemEffect', "none"}, {'useItemEffect', "none"},
{"setAnimation", "none", "walk", false}, {"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "start", 0, 0, 0.5, true}, {'goTo', "none", "actor", "start", 0, 0, 0.5, true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", "actor", 'idle', false},
}, },
onContact = { -- if the attack move and touch multiple ennemies, you can add onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -5,20 +5,20 @@ return {
["addGFX"] = {'sprite', "origin", "x", "y", "z", "affectedByDirection", 'blockProcess'}, ["addGFX"] = {'sprite', "origin", "x", "y", "z", "affectedByDirection", 'blockProcess'},
["playSFX"] = {"sfx"}, ["playSFX"] = {"sfx"},
["sendDamage"] = {"power", "type", "element", "isSpecial"}, ["sendDamage"] = {"power", "type", "element", "isSpecial"},
["goTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["goTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
["goTo3D"] = {"origin", "x", "y", "z", "duration", "blockProcess"}, ["goTo3D"] = {"who", "origin", "x", "y", "z", "duration", "blockProcess"},
["setAnimation"] = {"animation", "blockProcess"}, ["setAnimation"] = {"who", "animation", "blockProcess"},
["jump"] = {"power", "useDefaultAnimation", "blockProcess"}, ["jump"] = {"who", "power", "useDefaultAnimation", "blockProcess"},
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["jumpTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
["jumpBack"] = {"height", "speed", "blockProcess"}, ["jumpBack"] = {"who", "height", "speed", "blockProcess"},
["waitActorFinished"] = {"waitFor"}, ["waitActorFinished"] = {"waitFor"},
["setAnimSpeed"] = {"speed"}, ["setAnimSpeed"] = {"who", "speed"},
["waitFor"] = {"waitFor"}, ["waitFor"] = {"waitFor"},
["skipTo"] = {"skipTo"}, ["skipTo"] = {"skipTo"},
["addQTE"] = {"qteData", "origin", "blockProcess"}, ["addQTE"] = {"qteData", "origin", "blockProcess"},
["setCounter"] = {"counterName", "number", "relative"}, ["setCounter"] = {"counterName", "number", "relative"},
["useItemEffect"] = {}, ["useItemEffect"] = {},
["stopMov"] = {}, ["stopMov"] = {"who"},
--[name] = {args}, --[name] = {args},
}, },
argumentWrapper = "arguments", argumentWrapper = "arguments",

View file

@ -155,6 +155,16 @@ function ChoregraphySystem:haveFrameSignal(signal)
return self.actor:haveFrameSignal(signal) return self.actor:haveFrameSignal(signal)
end end
function ChoregraphySystem:getActor(name)
if (name == "actor") then
return self.actor
elseif (name == "target") then
return self.target.actor
else
return self.fighter.world:getActorByName(name)
end
end
function ChoregraphySystem:sendDamage(power, type, element, isSpecial) function ChoregraphySystem:sendDamage(power, type, element, isSpecial)
if (self.target ~= nil) then if (self.target ~= nil) then
if (self.fighter.isAlive) then if (self.fighter.isAlive) then

View file

@ -6,15 +6,16 @@ function GoToStep:new(controller, args)
end end
function GoToStep:start() function GoToStep:start()
local x, y = self:getStepCoordinate() local x, y = self:getStepCoordinate()
self.choregraphy.actor:goTo(x, y, self.arguments.duration) local actor = self:getActor(self.arguments.who)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "goTo") actor:goTo(x, y, self.arguments.duration)
actor:addTaggedAction(self.tag, self.choregraphy, "goTo")
if (self.arguments.blockProcess == false) then if (self.arguments.blockProcess == false) then
self:finish() self:finish()
else else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo") actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
end end
end end

View file

@ -6,15 +6,16 @@ function GoTo3DStep:new(controller, args)
end end
function GoTo3DStep:start() function GoTo3DStep:start()
local x, y, z = self:getStepCoordinate() local x, y, z = self:getStepCoordinate()
self.choregraphy.actor:goTo3D(x, y, z, self.arguments.duration) local actor = self:getActor(self.arguments.who)
actor:goTo3D(x, y, z, self.arguments.duration)
actor:addTaggedAction(self.tag, self.choregraphy, "goTo")
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "goTo")
if (self.arguments.blockProcess == false) then if (self.arguments.blockProcess == false) then
self:finish() self:finish()
else else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo") actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
end end
end end

View file

@ -6,13 +6,15 @@ function JumpStep:new(controller, args)
end end
function JumpStep:start() function JumpStep:start()
self.choregraphy.actor:setJump(self.arguments.power, 0, self.arguments.useDefaultAnimation) local actor = self:getActor(self.arguments.who)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "jump") actor:setJump(self.arguments.power, 0, self.arguments.useDefaultAnimation)
actor:addTaggedAction(self.tag, self.choregraphy, "jump")
if (self.arguments.blockProcess == false) then if (self.arguments.blockProcess == false) then
self:finish() self:finish()
else else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "jump") actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
end end
end end

View file

@ -6,14 +6,15 @@ function JumpBackStep:new(controller, args)
end end
function JumpBackStep:start() function JumpBackStep:start()
local actor = self:getActor(self.arguments.who)
self.choregraphy.actor:jumpBack(self.arguments.height, self.arguments.speed) actor:jumpBack(self.arguments.height, self.arguments.speed)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "jump") actor:addTaggedAction(self.tag, self.choregraphy, "jump")
if (self.arguments.blockProcess == false) then if (self.arguments.blockProcess == false) then
self:finish() self:finish()
else else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "jump") actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
end end
end end

View file

@ -24,20 +24,27 @@ function StepParent:updateStep(dt)
end end
end end
function StepParent:getActor(name)
return self.choregraphy:getActor(name)
end
function StepParent:getStepCoordinate() function StepParent:getStepCoordinate()
local argx, argy, argz = self.arguments.x, self.arguments.y, self.arguments.z or 0 local argx, argy, argz = self.arguments.x, self.arguments.y, self.arguments.z or 0
local x, y, z
argx = argx * self.choregraphy.actor.start.direction argx = argx * self.choregraphy.actor.start.direction
if (self.arguments.origin == "target") then local source = self.arguments.origin
local target = self.choregraphy.action.target
local x, y, z = target.actor:getCoordinate() if (source == "start") then
return x + argx, y + argy, z + argz x, y, z = self.choregraphy.actor.start.x, self.choregraphy.actor.start.y, self.choregraphy.actor.start.z
elseif (self.arguments.origin == "start") then else
local x, y, z = self.choregraphy.actor.start.x, self.choregraphy.actor.start.y, self.choregraphy.actor.start.z local actor = self:getActor(source)
return x + argx, y + argy, z + argz if (actor == nil) then
elseif (self.arguments.origin == "actor") then error("source " .. source .. " not found")
local x, y, z = self.choregraphy.actor:getCoordinate()
return x + argx, y + argy, z + argz
end end
x, y, z = actor.x, actor.y, actor.z
end
return x + argx, y + argy, z + argz
end end
function StepParent:finish() function StepParent:finish()

View file

@ -6,7 +6,9 @@ function SetAnimSpeedStep:new(controller, args)
end end
function SetAnimSpeedStep:start() function SetAnimSpeedStep:start()
self.choregraphy.actor:setAnimSpeed(self.arguments.speed) local actor = self:getActor(self.arguments.who)
actor:setAnimSpeed(self.arguments.speed)
self:finish() self:finish()
end end

View file

@ -6,13 +6,15 @@ function AnimationSetterStep:new(controller, args)
end end
function AnimationSetterStep:start() function AnimationSetterStep:start()
self.choregraphy.actor:changeAnimation(self.arguments.animation) local actor = self:getActor(self.arguments.who)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "animation") actor:changeAnimation(self.arguments.animation)
actor:addTaggedAction(self.tag, self.choregraphy, "animation")
if (self.arguments.blockProcess == false) then if (self.arguments.blockProcess == false) then
self:finish() self:finish()
else else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "animation") actor:blockChoregraphy(self.arguments.blockProcess, self, "animation")
end end
end end

View file

@ -6,7 +6,9 @@ function StopMovStep:new(controller, args)
end end
function StopMovStep:start() function StopMovStep:start()
self.choregraphy.actor:stopMoving() local actor = self:getActor(self.arguments.who)
actor:stopMoving()
self:finish() self:finish()
end end