Skip to content

Commit

Permalink
Merge #264
Browse files Browse the repository at this point in the history
264: Hitstop r=odecay a=Zac8668

Adds a way to set the time of the hit stop (time that the fighter/player is paralyzed on hit).
Closes #180 

Co-authored-by: Isaac <78173025+Zac8668@users.noreply.github.com>
Co-authored-by: otis <electricbuck@gmail.com>
  • Loading branch information
3 people authored Nov 4, 2022
2 parents 145b8ce + 8127dca commit 0c6fd8d
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 59 deletions.
3 changes: 3 additions & 0 deletions assets/fighters/bandit/bandit.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spritesheet:
running:
frames: [7, 10]
repeat: true
hitstun:
frames: [28, 30]
knocked_right:
frames: [35, 41]
knocked_left:
Expand All @@ -50,6 +52,7 @@ attack:
hitbox:
size: [36, 24]
offset: [24, 0]
hitstun_duration: 0.2

audio:
effects:
Expand Down
Binary file modified assets/fighters/big_bass/bass_base_156_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions assets/fighters/big_bass/big_bass.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spritesheet:
image: [bass_base_156_192.png]
tile_size: [156, 192]
columns: 15
rows: 3
rows: 5

animation_fps: 0.12
animations:
Expand All @@ -27,10 +27,12 @@ spritesheet:
running:
frames: [15, 24]
repeat: true
hitstun:
frames: [60, 66]
knocked_right:
frames: [0, 3]
frames: [60, 66]
knocked_left:
frames: [0, 3]
frames: [60, 66]
dying:
frames: [0, 3]
waiting:
Expand All @@ -49,6 +51,7 @@ attack:
hitbox:
size: [96, 32]
offset: [0, -69]
hitstun_duration: 0.2

audio:
effects:
Expand Down
3 changes: 3 additions & 0 deletions assets/fighters/brute/brute.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spritesheet:
running:
frames: [8, 11]
repeat: true
hitstun:
frames: [32, 34]
knocked_right:
frames: [40, 46]
knocked_left:
Expand All @@ -50,6 +52,7 @@ attack:
hitbox:
size: [36, 24]
offset: [24, 0]
hitstun_duration: 0.2

audio:
effects: {}
3 changes: 3 additions & 0 deletions assets/fighters/dev/dev.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spritesheet:
running:
frames: [14, 19]
repeat: true
hitstun:
frames: [71, 73]
knocked_right:
frames: [85, 90]
knocked_left:
Expand All @@ -47,6 +49,7 @@ attack:
hitbox:
size: [32, 32]
offset: [32, 0]
hitstun_duration: 0.2

audio:
effects:
Expand Down
4 changes: 4 additions & 0 deletions assets/fighters/fishy/fishy.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spritesheet:
running:
frames: [14, 19]
repeat: true
hitstun:
frames: [71, 73]
knocked_right:
frames: [85, 90]
knocked_left:
Expand All @@ -47,6 +49,8 @@ attack:
hitbox:
size: [32, 32]
offset: [32, 0]
hitstun_duration: 0.2
# velocity: [20.0, 0.0]

audio:
effects:
Expand Down
3 changes: 3 additions & 0 deletions assets/fighters/sharky/sharky.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spritesheet:
running:
frames: [14, 19]
repeat: true
hitstun:
frames: [71, 73]
knocked_right:
frames: [85, 90]
knocked_left:
Expand All @@ -47,6 +49,7 @@ attack:
hitbox:
size: [32, 32]
offset: [32, 0]
hitstun_duration: 0.2

audio:
effects:
Expand Down
3 changes: 3 additions & 0 deletions assets/fighters/slinger/slinger.fighter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spritesheet:
running:
frames: [7, 10]
repeat: true
hitstun:
frames: [21, 23]
knocked_right:
frames: [35, 41]
knocked_left:
Expand All @@ -54,6 +56,7 @@ attack:
hitbox:
size: [36, 24]
offset: [24, 0]
hitstun_duration: 0.2

audio:
effects: {}
1 change: 1 addition & 0 deletions assets/items/musket/musket.item.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kind: !ProjectileWeapon
hitbox:
size: [15, 15]
offset: [0, 0]
hitstun_duration: 0.2

bullet_velocity: 300
bullet_lifetime: 1
Expand Down
1 change: 1 addition & 0 deletions assets/items/sword/sword.item.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kind: !MeleeWeapon
hitbox:
size: [55, 70]
offset: [4, -4]
hitstun_duration: 0.2

spritesheet:
image: [sword.png]
Expand Down
3 changes: 3 additions & 0 deletions src/attack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct Attack {
pub damage: i32,
/// The direction and speed that the attack is hitting something in.
pub velocity: Vec2,
pub hitstun_duration: f32,
}

#[derive(Component)]
Expand Down Expand Up @@ -158,6 +159,7 @@ fn attack_damage_system(
let hurtbox_parent_entity = hurtbox_parent.get();
let (mut health, damageable) = damageables.get_mut(hurtbox_parent_entity).unwrap();

//apply damage to target
if **damageable {
**health -= attack.damage;

Expand All @@ -166,6 +168,7 @@ fn attack_damage_system(
damage_velocity: attack.velocity,
damage: attack.damage,
damaged_entity: hurtbox_parent_entity,
hitstun_duration: attack.hitstun_duration,
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub const MAX_Y: f32 = (GROUND_HEIGHT / 2.) + GROUND_Y;
//TODO: figure out a better way to do this than tacking on an extra offset
pub const MIN_Y: f32 = -(GROUND_HEIGHT / 2.) + GROUND_Y - 50.;

//TODO: remove in favor of loading attack velocity from YAML
pub const ATTACK_VELOCITY: f32 = 80.0;
pub const ITEM_ATTACK_VELOCITY: f32 = 80.0;
pub const HITSTUN_DURATION: f32 = 0.50;

pub const ITEM_LAYER: f32 = 100.;
pub const ITEM_WIDTH: f32 = 30.;
Expand Down
1 change: 1 addition & 0 deletions src/damage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ pub struct DamageEvent {
pub damageing_entity: Entity,
pub damaged_entity: Entity,
pub damage: i32,
pub hitstun_duration: f32,
}
Loading

0 comments on commit 0c6fd8d

Please sign in to comment.