Skip to content

Commit 6c9c95c

Browse files
bors[bot]odecay
andauthored
Merge #284
284: sound working for chain attacks r=odecay a=odecay Updated assets for Dev and chain system to work with sound effects on each attack. Co-authored-by: otis <[email protected]>
2 parents 93869d7 + fad9013 commit 6c9c95c

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

assets/fighters/dev/dev.fighter.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ audio:
8383
effects:
8484
attacking:
8585
87: flop.ogg
86+
chaining:
87+
114: flop.ogg
88+
followup:
89+
129: flop.ogg

src/fighter_state.rs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,15 @@ fn chaining(
933933
if !chaining.has_started {
934934
chaining.has_started = true;
935935
animation.play(Chaining::ANIMATION, false);
936+
// Play attack sound effect
937+
if let Some(effects) = fighter.audio.effect_handles.get(Chaining::ANIMATION)
938+
{
939+
let fx_playback = AnimationAudioPlayback::new(
940+
Chaining::ANIMATION.to_owned(),
941+
effects.clone(),
942+
);
943+
commands.entity(entity).insert(fx_playback);
944+
}
936945
}
937946
// Start the attack from the beginning
938947

@@ -945,6 +954,18 @@ fn chaining(
945954
if chaining.link >= Chaining::LENGTH {
946955
chaining.transition_to_final = true;
947956
}
957+
// Play attack sound effect
958+
if let Some(effects) = fighter
959+
.audio
960+
.effect_handles
961+
.get(Chaining::FOLLOWUP_ANIMATION)
962+
{
963+
let fx_playback = AnimationAudioPlayback::new(
964+
Chaining::FOLLOWUP_ANIMATION.to_owned(),
965+
effects.clone(),
966+
);
967+
commands.entity(entity).insert(fx_playback);
968+
}
948969
}
949970
chaining.can_extend = false;
950971

@@ -975,15 +996,6 @@ fn chaining(
975996
.insert(attack.frames)
976997
.id();
977998
commands.entity(entity).push_children(&[attack_entity]);
978-
979-
// Play attack sound effect
980-
if let Some(effects) = fighter.audio.effect_handles.get(Chaining::ANIMATION) {
981-
let fx_playback = AnimationAudioPlayback::new(
982-
Chaining::ANIMATION.to_owned(),
983-
effects.clone(),
984-
);
985-
commands.entity(entity).insert(fx_playback);
986-
}
987999
}
9881000
}
9891001

0 commit comments

Comments
 (0)