Make dashback configurable, fix movement bugs, add double jump forward and back.
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::fighter::animation::AnimKind;
|
||||
use crate::fighter::state::fall::FallState;
|
||||
use crate::fighter::state::ground::{self, GroundedMotionResult, GroundedStateCommon};
|
||||
use crate::fighter::state::{FighterState, dash, jump, wait, walk};
|
||||
use crate::input::FighterCommands;
|
||||
|
||||
#[derive(Debug, Clone, Hash)]
|
||||
pub struct TurnState {
|
||||
@@ -13,7 +14,13 @@ impl FighterStateImpl for TurnState {
|
||||
const NAME: &'static str = "Turn";
|
||||
fn check_interrupt(&self, state_context: &mut FighterStateContext) -> Option<FighterState> {
|
||||
// State chain that results in the turn completing
|
||||
if state_context.get_current_animation_frame() <= state_context.game_settings.input_common.turn_into_dashback_window as u32 {
|
||||
if let Some(state) = dash::check_input(state_context, &self.grounded_common) {
|
||||
return Some(state);
|
||||
}
|
||||
}
|
||||
if let Some(state) = jump::check_input(state_context, &self.grounded_common) {
|
||||
*state_context.facing_direction = state_context.facing_direction.reverse();
|
||||
Some(state)
|
||||
} else if state_context.is_current_animation_finished() {
|
||||
if let Some(state) = dash::check_input(state_context, &self.grounded_common) {
|
||||
@@ -78,14 +85,14 @@ pub fn check_input(
|
||||
grounded_common: &GroundedStateCommon,
|
||||
) -> Option<FighterState> {
|
||||
let input_frame = state_context.input.get_last_frame();
|
||||
let smash_input_frame_threshold = state_context
|
||||
.game_settings
|
||||
.input_common
|
||||
.smash_input_frame_threshold;
|
||||
|
||||
let has_smash_input = state_context.input.has_command(FighterCommands::SmashMoveLeft) || state_context.input.has_command(FighterCommands::SmashMoveRight);
|
||||
|
||||
if !input_frame.movement.x.is_zero()
|
||||
&& input_frame.movement.x.signum() != state_context.facing_direction.to_sign()
|
||||
&& state_context.input.get_frames_in_smash_move_deadzone() > smash_input_frame_threshold
|
||||
&& !has_smash_input
|
||||
{
|
||||
dbg!(input_frame.movement.x);
|
||||
return Some(FighterState::Turn(TurnState {
|
||||
grounded_common: grounded_common.clone(),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user