feat(cbs): add sfx playing to choregraphies

This commit is contained in:
Kazhnuz 2019-08-19 16:46:30 +02:00
parent 851a3d9804
commit 2658a6b54f
5 changed files with 15 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View file

@ -17,17 +17,25 @@ return {
-- if not nil : {ox, oy, shape, size, affectedByDirection} -- if not nil : {ox, oy, shape, size, affectedByDirection}
choregraphy = { -- the main attack choregraphy choregraphy = { -- the main attack choregraphy
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit1start', true}, {'setAnimation', "none", 'hit1start', true},
{'sendDamage', "none", 33, 100, false, false}, {'sendDamage', "none", 33, 100, false, false},
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit1end', true}, {'setAnimation', "none", 'hit1end', true},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit2start', true}, {'setAnimation', "none", 'hit2start', true},
{'sendDamage', "none", 33, 100, false, false}, {'sendDamage', "none", 33, 100, false, false},
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit2end', true}, {'setAnimation', "none", 'hit2end', true},
{'playSFX', "none", 'hit'},
{'setAnimation', "none", 'hit3start', true}, {'setAnimation', "none", 'hit3start', true},
{'sendDamage', "none", 33, 100, false, false}, {'sendDamage', "none", 33, 100, false, false},
{'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false}, {'addGFX',"sentDamage", 'hitGFX', 0.75, 0, true, false},
{'playSFX', "sentDamage", 'hitconnect'},
{'setAnimation', "none", 'hit3end', true}, {'setAnimation', "none", 'hit3end', true},
{'setAnimation', "none", 'idle', false}, {'setAnimation', "none", 'idle', false},
{'wait', "none", 0.5} {'wait', "none", 0.5}

View file

@ -313,6 +313,9 @@ function Hero:doChoregraphyAction(choregraphyAction)
local z = 0 local z = 0
self.world.obj.GFX(self.world, x + dx, y + dy, z, sprite, self, blockProcess) self.world.obj.GFX(self.world, x + dx, y + dy, z, sprite, self, blockProcess)
elseif type == "playSFX" then
local sfx = choregraphyAction[3]
self.assets.sfx[sfx]:play()
else else
core.debug:warning("cbs/hero", "unknown action type " .. type) core.debug:warning("cbs/hero", "unknown action type " .. type)
end end

View file

@ -33,5 +33,9 @@ return {
["imagefonts"] = { ["imagefonts"] = {
{"hudnbrs", "assets/gui/fonts/hudnumbers"}, {"hudnbrs", "assets/gui/fonts/hudnumbers"},
{"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"}, {"hudnbrs_small", "assets/gui/fonts/hudsmallnumbers"},
},
["sfx"] = {
{"hit", "assets/sfx/hit.wav"},
{"hitconnect", "assets/sfx/hitconnect.wav"},
} }
} }