Skip to content

Commit e22613c

Browse files
committed
added animation, tuned
1 parent b870260 commit e22613c

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

assets/fighters/dev/dev.fighter.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ spritesheet:
3838
attacking:
3939
frames: [85, 90]
4040
chaining:
41+
frames: [112, 116]
42+
followup:
4143
frames: [126, 131]
4244

4345
# attacks need longer recovery vs startup
@@ -56,8 +58,8 @@ attacks:
5658
- name: "flop"
5759
damage: 50
5860
frames:
59-
startup: 1
60-
active: 2
61+
startup: 0
62+
active: 1
6163
recovery: 4
6264
hitbox:
6365
size: [32, 32]

src/fighter_state.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ pub struct Chaining {
291291
impl Chaining {
292292
pub const PRIORITY: i32 = 30;
293293
pub const ANIMATION: &'static str = "chaining";
294+
pub const FOLLOWUP_ANIMATION: &'static str = "followup";
294295
pub const LENGTH: u32 = 2;
295296
}
296297

@@ -923,33 +924,35 @@ fn chaining(
923924
if let Some(attack) = available_attacks
924925
.attacks
925926
.iter()
926-
.filter(|a| a.name == "chain".to_string())
927+
.filter(|a| a.name == *"chain")
927928
.last()
928929
{
929930
if let Some(fighter) = fighter_assets.get(meta_handle) {
930931
//if we havent started the chain yet or if we have input during chain window
931932
if !chaining.has_started || chaining.continue_chain && chaining.can_extend {
932-
chaining.has_started = true;
933-
chaining.can_extend = false;
933+
if !chaining.has_started {
934+
chaining.has_started = true;
935+
animation.play(Chaining::ANIMATION, false);
936+
}
934937
// Start the attack from the beginning
935938

936-
animation.play(Chaining::ANIMATION, false);
937939
//if we are on chain followup, skip the first frame of the animation
938940
if chaining.continue_chain {
941+
animation.play(Chaining::FOLLOWUP_ANIMATION, false);
939942
animation.current_frame = 2;
940943
chaining.continue_chain = false;
941944
chaining.link += 1;
942945
if chaining.link >= Chaining::LENGTH {
943946
chaining.transition_to_final = true;
944947
}
945948
}
949+
chaining.can_extend = false;
946950

947951
let mut offset = attack.hitbox.offset;
948952
if facing.is_left() {
949953
offset.x *= -1.0
950954
}
951955
offset.y += fighter.collision_offset;
952-
// let attack_frames = attack.frames;
953956
// Spawn the attack entity
954957
let attack_entity = commands
955958
.spawn_bundle(TransformBundle::from_transform(
@@ -990,8 +993,7 @@ fn chaining(
990993
// Reset velocity
991994
**velocity = Vec2::ZERO;
992995

993-
// Do a forward jump thing
994-
//TODO: Fix hacky way to get a forward jump
996+
//move forward a bit during active frames
995997
if animation.current_frame > attack.frames.startup
996998
&& animation.current_frame < attack.frames.recovery
997999
{

src/metadata.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ pub struct AttackMeta {
126126
pub item_handle: Handle<ItemMeta>,
127127
}
128128

129-
// pub struct AttackChainMeta {
130-
// pub attacks: AttackMeta
131-
// }
132-
133129
#[derive(TypeUuid, Deserialize, Clone, Debug, Component)]
134130
#[serde(deny_unknown_fields)]
135131
#[uuid = "5e2db270-ec2e-013a-92a8-2cf05d71216b"]

0 commit comments

Comments
 (0)