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,
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},
{'addGFX', "sentDamage", 'hitGFX', "target", -0.4, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true},
{'jumpBack', "none", "actor", 4, 8, true},
{"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

View file

@ -14,20 +14,20 @@ return {
targetEnnemies = true,
choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false},
{"taggedAction", "playerMove", {"goTo", "none", "target", 0, 0, 0.6, false}},
{"setAnimation", "none", "actor", "walk", false},
{"taggedAction", "playerMove", {"goTo", "none", "actor", "target", 0, 0, 0.6, false}},
{"wait", "none", 0.3},
{"setAnimation", "none", "spin", false},
{"setAnimation", "none", "actor", "spin", false},
{'playSFX', "none", 'spinrelease'},
{"waitFor", "none", "actionFinished:playerMove"},
{"sendDamage", "none", 100, "basic", "none", false},
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true},
{'jumpBack', "none", "actor", 4, 8, true},
{"wait", "none", 0.1},
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", "actor", 'idle', false},
},
onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -14,45 +14,45 @@ return {
targetEnnemies = true,
choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false},
{'goTo', "none", "target", -1, 0, 0.3, false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "target", -1, 0, 0.3, false},
{"wait", "none", 0.15},
{"taggedAction", "comboQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}, {"A", 1}, {"B", 1}}, 0.5}, "target", false}},
{"wait", "none", 0.15},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit1start', true},
{'setAnimation', "none", "actor", 'hit1start', true},
{'sendDamage', "none", 40, "basic", "none", false},
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit1end', true},
{'setAnimation', "none", "actor", 'hit1end', true},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit2start', true},
{'setAnimation', "none", "actor", 'hit2start', true},
{'sendDamage', "none", 40, "basic", "none", false},
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit2end', true},
{'setAnimation', "none", "actor", 'hit2end', true},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit3start', true},
{'setAnimation', "none", "actor", 'hit3start', true},
{'sendDamage', "none", 40, "basic", "none", false},
{'addGFX',"sentDamage", 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit3end', true},
{'setAnimation', "none", 'idle', false},
{'setAnimation', "none", "actor", 'hit3end', true},
{'setAnimation', "none", "actor", 'idle', false},
{'waitFor', "none", "actionFinished:comboQte"},
{"setAnimation", "qteSuccess:1", "upper", false},
{"setAnimation", "qteSuccess:1", "actor", "upper", false},
{"waitFor", "qteSuccess:1", "haveFrameSignal:hitconnect"},
{'sendDamage', "qteSuccess:1", 75, "basic", "none", false},
{'addGFX', {"qteSuccess:1", "sentDamage"}, 'hitGFX', "actor", 0.75, 0, 0, true, false},
{'playSFX', {"qteSuccess:1", "sentDamage"}, 'hitconnect'},
{'wait', "none", 0.2},
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", "actor", 'idle', false},
},
onContact = { -- if the attack move and touch multiple ennemies, you can add

View file

@ -14,21 +14,21 @@ return {
targetEnnemies = true,
choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 5, 0, 0.5, true},
{"taggedAction", "jumpingHero", {'jump', "none", 5.5, true, false}},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 5, 0, 0.5, true},
{"taggedAction", "jumpingHero", {'jump', "none", "actor", 5.5, true, false}},
{"taggedAction", "hommingQte", {"addQTE", "none", {"simplePrompt", {{"A", 1}}, 0.4}, "target", false}},
{"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},
{"setAnimation", "none", "spin", false},
{"setAnimation", "none", "actor", "spin", false},
{'playSFX', "none", 'spinrelease'},
{"waitFor", "none", "actionFinished:dashToEnnemy"},
{"sendDamage", "none", 30, "aerial", "none", false},
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 4, true, false},
{'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},
{"setCounter", "none", "spinSpam", 1, true},
@ -37,9 +37,9 @@ return {
{"skipTo", {"counter:spinSpam:lt:5", "qteSuccess"}, "dashToEnnemy"},
{"waitFor", "none", "actionFinished:jumpingHero"},
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", "actor", 'idle', false},
},
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
targetEnnemies = true,
choregraphy = {
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 2, 0, 0.5, true},
{"setAnimation", "none", "spindash", false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 2, 0, 0.5, true},
{"setAnimation", "none", "actor", "spindash", false},
{'playSFX', "none", 'spincharge'},
{"wait", "none", 1},
{"setAnimation", "none", "spin", false},
{"setAnimation", "none", "actor", "spin", false},
{'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},
{'addGFX', "sentDamage", 'hitGFX', "target", 0, 0, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'jumpBack', "none", 4, 8, true},
{'jumpBack', "none", "actor", 4, 8, true},
{"wait", "none", 0.1},
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 0, 0, 0.3, true},
{'setAnimation', "none", 'idle', false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 0, 0, 0.3, true},
{'setAnimation', "none", "actor", 'idle', false},
}
}

View file

@ -12,16 +12,16 @@ return {
targetNumber = 1, -- 0 for targeting all ennemies
choregraphy = { -- the main attack choregraphy
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 2, 0, 0.5, true},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 2, 0, 0.5, true},
{'setAnimation', "none", 'idle', false},
{'setAnimation', "none", "actor", 'idle', false},
{'wait', "none", 0.4},
{'useItemEffect', "none"},
{"setAnimation", "none", "walk", false},
{'goTo', "none", "start", 0, 0, 0.5, true},
{'setAnimation', "none", 'idle', false},
{"setAnimation", "none", "actor", "walk", false},
{'goTo', "none", "actor", "start", 0, 0, 0.5, true},
{'setAnimation', "none", "actor", 'idle', false},
},
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'},
["playSFX"] = {"sfx"},
["sendDamage"] = {"power", "type", "element", "isSpecial"},
["goTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["goTo3D"] = {"origin", "x", "y", "z", "duration", "blockProcess"},
["setAnimation"] = {"animation", "blockProcess"},
["jump"] = {"power", "useDefaultAnimation", "blockProcess"},
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["jumpBack"] = {"height", "speed", "blockProcess"},
["goTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
["goTo3D"] = {"who", "origin", "x", "y", "z", "duration", "blockProcess"},
["setAnimation"] = {"who", "animation", "blockProcess"},
["jump"] = {"who", "power", "useDefaultAnimation", "blockProcess"},
["jumpTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
["jumpBack"] = {"who", "height", "speed", "blockProcess"},
["waitActorFinished"] = {"waitFor"},
["setAnimSpeed"] = {"speed"},
["setAnimSpeed"] = {"who", "speed"},
["waitFor"] = {"waitFor"},
["skipTo"] = {"skipTo"},
["addQTE"] = {"qteData", "origin", "blockProcess"},
["setCounter"] = {"counterName", "number", "relative"},
["useItemEffect"] = {},
["stopMov"] = {},
["stopMov"] = {"who"},
--[name] = {args},
},
argumentWrapper = "arguments",

View file

@ -155,6 +155,16 @@ function ChoregraphySystem:haveFrameSignal(signal)
return self.actor:haveFrameSignal(signal)
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)
if (self.target ~= nil) then
if (self.fighter.isAlive) then

View file

@ -6,15 +6,16 @@ function GoToStep:new(controller, args)
end
function GoToStep:start()
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
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
end
end

View file

@ -6,15 +6,16 @@ function GoTo3DStep:new(controller, args)
end
function GoTo3DStep:start()
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
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
end
end

View file

@ -6,13 +6,15 @@ function JumpStep:new(controller, args)
end
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
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
end
end

View file

@ -6,14 +6,15 @@ function JumpBackStep:new(controller, args)
end
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
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
end
end

View file

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

View file

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

View file

@ -6,13 +6,15 @@ function AnimationSetterStep:new(controller, args)
end
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
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "animation")
actor:blockChoregraphy(self.arguments.blockProcess, self, "animation")
end
end

View file

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