Implement grounded fighter pushing #85

Merged
EIREXE merged 4 commits from feature/grounded-fighter-pushing into master 2026-10-07 07:29:02 +00:00
5 changed files with 3 additions and 9 deletions
Showing only changes of commit a3fe5123f1 - Show all commits
-1
View File
@@ -99,7 +99,6 @@ impl FighterStateImpl for DashState {
ground::apply_grounded_motion(
state_context.velocity,
state_context.translation,
state_context.prev_translation,
);
}
+3 -5
View File
@@ -6,7 +6,7 @@ use crate::fighter::state::{
CollisionContext, FighterState, InterruptContext, air, crouch, dash, fall, ground_attack, turn, wait, walk,
};
use crate::fighter::{
FighterAttributes, FighterPreviousTranslation, FighterTranslation, FighterVelocity,
FighterAttributes, FighterTranslation, FighterVelocity,
};
use crate::game_settings::GameSettings;
use crate::math::int::{FGWide, FGi32};
@@ -149,10 +149,8 @@ fn resolve_grounded_position(
pub fn apply_grounded_motion(
velocity: &FighterVelocity,
translation: &mut FighterTranslation,
prev_translation: &mut FighterPreviousTranslation,
) {
// Vertical velocity should be 0 on the ground
prev_translation.0 = translation.0;
translation.0 += FGVec2::new(velocity.0.x, FGi32::ZERO);
}
@@ -169,7 +167,7 @@ pub fn update_friction_motion(ctx: &mut crate::fighter::state::UpdateContext) {
let ground_velocity = ctx.velocity.x;
ctx.velocity.x += apply_grounded_friction(friction, ground_velocity);
apply_grounded_motion(ctx.velocity, ctx.translation, ctx.prev_translation);
apply_grounded_motion(ctx.velocity, ctx.translation);
}
pub fn collide_with_stage_grounded(
@@ -246,7 +244,7 @@ pub fn collision_interrupt(ctx: &mut CollisionContext, can_walk_off: bool) -> Op
mod tests {
use super::*;
use crate::fighter::ecb::FighterPreviousECB;
use crate::fighter::{FighterECB, FighterSurfaceState};
use crate::fighter::{FighterECB, FighterPreviousTranslation, FighterSurfaceState};
use crate::stage::line::StagePolyType;
use crate::input::FighterInput;
-1
View File
@@ -50,7 +50,6 @@ impl FighterStateImpl for GroundAttackState {
ground::apply_grounded_motion(
state_context.velocity,
state_context.translation,
state_context.prev_translation,
);
} else {
ground::update_friction_motion(state_context);
-1
View File
@@ -48,7 +48,6 @@ impl FighterStateImpl for RunState {
ground::apply_grounded_motion(
state_context.velocity,
state_context.translation,
state_context.prev_translation,
);
}
-1
View File
@@ -40,7 +40,6 @@ impl FighterStateImpl for WalkState {
ground::apply_grounded_motion(
state_context.velocity,
state_context.translation,
state_context.prev_translation,
);
}