Overworld Movement #9
1 changed files with 5 additions and 4 deletions
|
@ -31,14 +31,15 @@ impl Ghost {
|
|||
let secs = now
|
||||
.duration_since(self.overworld_pos_last_update)
|
||||
.as_secs_f32();
|
||||
let mut movement =
|
||||
self.overworld_movement_pending * self.overworld_movement_speed * secs;
|
||||
let mut movement = self.overworld_movement_pending.signum()
|
||||
* self.overworld_movement_speed
|
||||
* secs;
|
||||
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue