summaryrefslogtreecommitdiff
path: root/src/world.rs
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2022-02-02 19:08:44 +0100
committerTom Barrett <tom@tombarrett.xyz>2022-02-02 19:08:44 +0100
commitceb3eff116f9ddf8dcb71a0a77efb63531f75ab2 (patch)
treec818ad7241797fa72e0cb802f09c9a1b296e1fb0 /src/world.rs
parent8cdbe7352c4846eb339358bcca6083f747e27721 (diff)
2022 updateHEADmaster
Diffstat (limited to 'src/world.rs')
-rw-r--r--src/world.rs7
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 {