Implement up smash, dacus and further improve input system. (#88)
Reviewed-on: #88 Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #88.
This commit is contained in:
@@ -182,6 +182,7 @@ mod tests {
|
||||
air_dodge_decay: FGi32::ZERO,
|
||||
air_dodge_intangible_duration: 29,
|
||||
air_dodge_intangible_start: 4,
|
||||
dash_attack_cancel_window: 3,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ impl FighterStateImpl for DashState {
|
||||
fn check_interrupt(&self, ctx: &mut InterruptContext) -> Option<FighterState> {
|
||||
let attributes = ctx.fighter_attributes;
|
||||
|
||||
if ctx.get_current_animation_frame() <= 2 {
|
||||
if ctx.get_current_animation_frame() <= 2 || ctx.input.get_last_frame().movement.x.signum() != self.direction.to_sign() {
|
||||
if let Some(state) = ground_attack::check_interrupt(ctx) {
|
||||
return Some(state);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,19 @@ impl FighterStateImpl for GroundAttackState {
|
||||
const NAME: &'static str = "GroundAttack";
|
||||
|
||||
fn check_interrupt(&self, state_context: &mut InterruptContext) -> Option<FighterState> {
|
||||
// Allow interrupting dash attack only into an up/down smash
|
||||
if let AttackKind::DashAttack = self.attack_kind {
|
||||
if state_context.get_current_animation_frame() < state_context.fighter_attributes.dash_attack_cancel_window {
|
||||
if let Some(state) = check_interrupt(state_context) {
|
||||
if let FighterState::GroundAttack(state) = state {
|
||||
if matches!(state.attack_kind, AttackKind::UpSmash) || matches!(state.attack_kind, AttackKind::DownSmash) {
|
||||
return Some(FighterState::GroundAttack(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if state_context.is_current_animation_finished() {
|
||||
Some(FighterState::Wait(WaitState))
|
||||
} else {
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
|
||||
use crate::{
|
||||
fighter::{
|
||||
animation::AnimKind,
|
||||
state::{
|
||||
CollisionContext, EnterContext, FighterState, FighterStateImpl, InterruptContext,
|
||||
UpdateContext,
|
||||
air::{self, AirborneStateCommon},
|
||||
air_dodge::AirDodgeState,
|
||||
ground,
|
||||
animation::AnimKind, state::{
|
||||
CollisionContext, EnterContext, FighterState, FighterStateImpl, InterruptContext, UpdateContext, air::{self, AirborneStateCommon}, air_dodge::AirDodgeState, ground, ground_attack,
|
||||
},
|
||||
},
|
||||
input::{DigitalAction, FighterCommands},
|
||||
math::{int::FGi32, vec::FGVec2},
|
||||
}, input::{DigitalAction, FighterCommands}, math::{int::FGi32, vec::FGVec2},
|
||||
};
|
||||
#[derive(Debug, Hash, Clone, Copy)]
|
||||
pub enum JumpType {
|
||||
@@ -52,6 +45,9 @@ impl FighterStateImpl for JumpSquatState {
|
||||
const NAME: &'static str = "JumpSquat";
|
||||
|
||||
fn check_interrupt(&self, state_context: &mut InterruptContext) -> Option<FighterState> {
|
||||
if let Some(state) = ground_attack::check_interrupt(state_context) {
|
||||
return Some(state);
|
||||
}
|
||||
// Special handling for wavedash from jump squat
|
||||
if state_context.input.has_command(FighterCommands::Shield) {
|
||||
// If aiming sideways and in the deadzone, do a perfect wavedash
|
||||
|
||||
Reference in New Issue
Block a user