From d44e5cccf965b4a31b61cf2b68a77b47f8475608 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik <contact@louiscap.co> Date: Thu, 8 Dec 2022 19:13:14 +0000 Subject: [PATCH] Adjust movement for very slow systems --- .gitignore | 3 ++- game_core/src/system/resources.rs | 2 +- game_core/src/world/towns.rs | 3 +++ game_core/src/world/travel.rs | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3ad33f1..044cdb5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ .idea/ .vscode/ -dist/ \ No newline at end of file +dist/ +artifacts/ \ No newline at end of file diff --git a/game_core/src/system/resources.rs b/game_core/src/system/resources.rs index fbab91f..4731dc2 100644 --- a/game_core/src/system/resources.rs +++ b/game_core/src/system/resources.rs @@ -21,7 +21,7 @@ pub fn configure_default_plugins() -> PluginGroupBuilder { height, resizable: true, mode: WindowMode::Windowed, - title: String::from("Bevy 2D Template"), + title: String::from("Trader Tales"), present_mode: PresentMode::AutoNoVsync, ..Default::default() }, diff --git a/game_core/src/world/towns.rs b/game_core/src/world/towns.rs index a538869..39921b8 100644 --- a/game_core/src/world/towns.rs +++ b/game_core/src/world/towns.rs @@ -45,6 +45,7 @@ pub enum PathingResult { Travelling, NextNode, PathComplete, + TravelTo(Vec2), } fn calculate_distance(points: &mut impl Iterator<Item = Vec2>) -> f32 { @@ -86,6 +87,8 @@ impl TravelPath { if let Some(next) = self.path.get(self.next_index) { if current.distance(*next).abs() < 0.05 { PathingResult::NextNode + } else if current.distance(*next).abs() < 0.15 { + PathingResult::TravelTo(*next) } else { PathingResult::Travelling } diff --git a/game_core/src/world/travel.rs b/game_core/src/world/travel.rs index a321936..6d58b11 100644 --- a/game_core/src/world/travel.rs +++ b/game_core/src/world/travel.rs @@ -49,6 +49,9 @@ pub fn tick_travelling_merchant( PathingResult::NextNode => { path.increment_indexes(); } + PathingResult::TravelTo(new_point) => { + transform.translation = new_point.extend(transform.translation.z); + } PathingResult::Travelling => {} } } -- GitLab