aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/protocol/src/movement.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/server/protocol/src/movement.rs b/server/protocol/src/movement.rs
index 14aefacb..062c250d 100644
--- a/server/protocol/src/movement.rs
+++ b/server/protocol/src/movement.rs
@@ -22,8 +22,8 @@ use crate::{
use std::collections::HashSet;
const PLAYER_SIZE: f32 = 0.4;
-const PLAYER_FRICTION: f32 = 15.0;
-const PLAYER_SPEED: f32 = 55.0;
+const PLAYER_ACCELERATION: f32 = 10.0;
+const PLAYER_SPEED: f32 = 3.8;
const BOOST_FACTOR: f32 = 2.5;
const BOOST_DURATION: f32 = 0.3;
const BOOST_RESTORE: f32 = 0.5;
@@ -74,10 +74,9 @@ impl MovementBase {
dt / BOOST_RESTORE
};
self.stamina = self.stamina.clamp(0., 1.);
- let speed = PLAYER_SPEED * if self.boosting { BOOST_FACTOR } else { 1. };
- self.velocity += direction * dt * speed;
+ let target_v = direction * (PLAYER_SPEED * if self.boosting { BOOST_FACTOR } else { 1. });
+ self.velocity = target_v + (self.velocity - target_v) * (-dt * PLAYER_ACCELERATION).exp();
self.position += self.velocity * dt;
- self.velocity *= (-dt * PLAYER_FRICTION).exp();
collide_player_tiles(self, map);
}