Tweak player's movement

Changelog:
- Increase ground friction generally.
- Reduce friction when the player is moving on the ground. To compensate,
  reduce player acceleration as well. Now, the player stops faster
  without losing too much max speed.
scene_man
En Yi 2023-08-17 23:20:52 +08:00
parent 3a4671cecc
commit 4d12a02f91
2 changed files with 4 additions and 3 deletions

View File

@ -35,7 +35,7 @@
#define PLAYER_MAX_SPEED 800
#define WATER_FRICTION 7.5
#define GROUND_X_FRICTION 5.8
#define GROUND_X_FRICTION 6.1
#define GROUND_Y_FRICTION 1.0
#define ARROW_SPEED 350

View File

@ -761,9 +761,10 @@ void friction_coefficient_update_system(Scene_t* scene)
}
CPlayerState_t* p_pstate = get_component(p_ent, CPLAYERSTATE_T);
if (p_pstate != NULL && (p_pstate->is_crouch & 1))
if (p_pstate != NULL)
{
p_ct->fric_coeff.x -= 4;
if (p_pstate->is_crouch & 1) p_ct->fric_coeff.x -= 4;
if ((p_mstate->ground_state & 1) && p_pstate->player_dir.x != 0) p_ct->fric_coeff.x *= 0.9;
}
}
}