Make dashback configurable, fix movement bugs, add double jump forward and back.
This commit is contained in:
@@ -11,14 +11,21 @@ use crate::fighter::{
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
pub enum LandingType {
|
||||
Normal,
|
||||
Special
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
pub struct LandingState {
|
||||
pub grounded_common: GroundedStateCommon,
|
||||
pub landing_type: LandingType,
|
||||
}
|
||||
|
||||
impl LandingState {
|
||||
pub fn create(grounded_common: GroundedStateCommon) -> Self {
|
||||
Self { grounded_common }
|
||||
pub fn create(grounded_common: GroundedStateCommon, landing_type: LandingType) -> Self {
|
||||
Self { grounded_common, landing_type }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +36,7 @@ impl FighterStateImpl for LandingState {
|
||||
if state_context.is_current_animation_finished() {
|
||||
grounded_movement_standstill_common_interrupts(state_context, &self.grounded_common)
|
||||
} else if state_context.get_current_animation_frame()
|
||||
>= state_context.fighter_manifest.attributes.landing_iasa
|
||||
>= state_context.fighter_manifest.attributes.landing_iasa && let LandingType::Normal = self.landing_type
|
||||
{
|
||||
dash::check_input(state_context, &self.grounded_common).or_else(|| {
|
||||
ground::grounded_movement_common_interrupts(state_context, &self.grounded_common)
|
||||
@@ -69,7 +76,7 @@ impl FighterStateImpl for LandingState {
|
||||
state_context: &mut FighterStateContext,
|
||||
) -> Option<FighterState> {
|
||||
if let GroundedMotionResult::InAir =
|
||||
ground::collide_with_stage_grounded(state_context, &mut self.grounded_common, false)
|
||||
ground::collide_with_stage_grounded(state_context, &mut self.grounded_common, true)
|
||||
{
|
||||
Some(FighterState::Fall(FallState))
|
||||
} else {
|
||||
@@ -78,6 +85,13 @@ impl FighterStateImpl for LandingState {
|
||||
}
|
||||
|
||||
fn on_enter(&mut self, state_context: &mut FighterStateContext) {
|
||||
state_context.play_animation(AnimKind::Landing, false);
|
||||
match self.landing_type {
|
||||
LandingType::Normal => {
|
||||
state_context.play_animation(AnimKind::Landing, false);
|
||||
},
|
||||
LandingType::Special => {
|
||||
state_context.play_animation(AnimKind::LandingSpecial, false);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user