Overworld Movement #9

Merged
msrd0 merged 9 commits from move_overworld into main 2024-07-07 08:49:20 +00:00
Showing only changes of commit 89bc156f52 - Show all commits

View file

@ -31,14 +31,15 @@ impl Ghost {
let secs = now let secs = now
.duration_since(self.overworld_pos_last_update) .duration_since(self.overworld_pos_last_update)
.as_secs_f32(); .as_secs_f32();
let mut movement = let mut movement = self.overworld_movement_pending.signum()
self.overworld_movement_pending * self.overworld_movement_speed * secs; * self.overworld_movement_speed
* secs;
// limit the movement to the remaining movement // limit the movement to the remaining movement
if self.overworld_movement_pending.x.abs() < movement.x.abs() + 1e-2 { if self.overworld_movement_pending.x.abs() < movement.x.abs() {
movement.x = self.overworld_movement_pending.x; movement.x = self.overworld_movement_pending.x;
} }
if self.overworld_movement_pending.y.abs() < movement.y.abs() + 1e-2 { if self.overworld_movement_pending.y.abs() < movement.y.abs() {
movement.y = self.overworld_movement_pending.y; movement.y = self.overworld_movement_pending.y;
} }