diff --git a/src/app.rs b/src/app.rs index 9ce233c..4f38a0a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -69,16 +69,16 @@ impl App { 2 }; if self.kb_input.down(Key::Left) { - self.game.camera_offset.x -= spd; + self.game.camera_offset.x = self.game.camera_offset.x.saturating_sub(spd); } if self.kb_input.down(Key::Right) { - self.game.camera_offset.x += spd; + self.game.camera_offset.x = self.game.camera_offset.x.saturating_add(spd); } if self.kb_input.down(Key::Up) { - self.game.camera_offset.y -= spd; + self.game.camera_offset.y = self.game.camera_offset.y.saturating_sub(spd); } if self.kb_input.down(Key::Down) { - self.game.camera_offset.y += spd; + self.game.camera_offset.y = self.game.camera_offset.y.saturating_add(spd); } let tp = self.game.camera_offset.tile_pos(); imm_dbg!(tp);