diff options
Diffstat (limited to 'src/world.rs')
-rw-r--r-- | src/world.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/world.rs b/src/world.rs index 4e9a965..877253b 100644 --- a/src/world.rs +++ b/src/world.rs @@ -1,7 +1,7 @@ use ggez::event::KeyCode; use ggez::graphics::spritebatch::SpriteBatch; -use ggez::nalgebra::distance; use ggez::{filesystem, Context}; +use glam; use crate::constants; use crate::dialogbox::DialogTree; @@ -55,7 +55,7 @@ impl World { pub fn player_in_talking_range(&mut self) -> bool { if let Some(npc) = self.npcs.iter_mut().find(|npc| npc.is_talking()) { if constants::INTERACT_DISTANCE - > distance(&self.player.entity.position, &npc.entity.position) + > glam::f32::Vec2::distance(self.player.entity.position, npc.entity.position) { true } else { @@ -70,7 +70,8 @@ impl World { pub fn get_dialogtree(&mut self) -> Option<DialogTree> { let player_position = self.player.entity.position; if let Some(npc) = self.npcs.iter_mut().find(|npc| { - constants::INTERACT_DISTANCE > distance(&player_position, &npc.entity.position) + constants::INTERACT_DISTANCE + > glam::f32::Vec2::distance(player_position, npc.entity.position) }) { Some(npc.get_dialogtree()) } else { |