diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-19 20:41:33 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-19 20:41:40 +0200 |
commit | 02af3843b695857e9832434336cf093968f00ff5 (patch) | |
tree | 14b0763d1bea8f4f1bc9246320b140dee1dd5508 /server/protocol/src | |
parent | 8b32c50e1bb2b8c8b00105c13c31b896ebab7f8a (diff) | |
download | hurrycurry-02af3843b695857e9832434336cf093968f00ff5.tar hurrycurry-02af3843b695857e9832434336cf093968f00ff5.tar.bz2 hurrycurry-02af3843b695857e9832434336cf093968f00ff5.tar.zst |
update movement code everywhere
Diffstat (limited to 'server/protocol/src')
-rw-r--r-- | server/protocol/src/movement.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/protocol/src/movement.rs b/server/protocol/src/movement.rs index ebcc627d..85accb31 100644 --- a/server/protocol/src/movement.rs +++ b/server/protocol/src/movement.rs @@ -58,10 +58,13 @@ impl MovementBase { } pub fn update(&mut self, map: &HashSet<IVec2>, dt: f32) { let mut boost = self.input_boost; - let direction = self.input_direction.clamp_length_max(1.); - if direction.length() > 0.1 { + let mut direction = self.input_direction.clamp_length_max(1.); + if direction.length() > 0.05 { self.facing = direction + (self.facing - direction) * (-dt * 10.).exp(); } + if direction.length() < 0.5 { + direction *= 0.; + } self.rotation = self.facing.x.atan2(self.facing.y); boost &= direction.length() > 0.1; self.boosting = boost && (self.boosting || self.stamina >= 1.) && self.stamina > 0.; |