From ceb3eff116f9ddf8dcb71a0a77efb63531f75ab2 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Wed, 2 Feb 2022 19:08:44 +0100 Subject: 2022 update --- src/world.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/world.rs') 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 { 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 { -- cgit v1.2.3