Skip to content
Snippets Groups Projects
Verified Commit d44e5ccc authored by Louis's avatar Louis :fire:
Browse files

Adjust movement for very slow systems

parent 8a7ff74a
No related branches found
No related tags found
No related merge requests found
Pipeline #250 passed with stages
in 3 minutes and 44 seconds
...@@ -7,4 +7,5 @@ ...@@ -7,4 +7,5 @@
.idea/ .idea/
.vscode/ .vscode/
dist/ dist/
\ No newline at end of file artifacts/
\ No newline at end of file
...@@ -21,7 +21,7 @@ pub fn configure_default_plugins() -> PluginGroupBuilder { ...@@ -21,7 +21,7 @@ pub fn configure_default_plugins() -> PluginGroupBuilder {
height, height,
resizable: true, resizable: true,
mode: WindowMode::Windowed, mode: WindowMode::Windowed,
title: String::from("Bevy 2D Template"), title: String::from("Trader Tales"),
present_mode: PresentMode::AutoNoVsync, present_mode: PresentMode::AutoNoVsync,
..Default::default() ..Default::default()
}, },
......
...@@ -45,6 +45,7 @@ pub enum PathingResult { ...@@ -45,6 +45,7 @@ pub enum PathingResult {
Travelling, Travelling,
NextNode, NextNode,
PathComplete, PathComplete,
TravelTo(Vec2),
} }
fn calculate_distance(points: &mut impl Iterator<Item = Vec2>) -> f32 { fn calculate_distance(points: &mut impl Iterator<Item = Vec2>) -> f32 {
...@@ -86,6 +87,8 @@ impl TravelPath { ...@@ -86,6 +87,8 @@ impl TravelPath {
if let Some(next) = self.path.get(self.next_index) { if let Some(next) = self.path.get(self.next_index) {
if current.distance(*next).abs() < 0.05 { if current.distance(*next).abs() < 0.05 {
PathingResult::NextNode PathingResult::NextNode
} else if current.distance(*next).abs() < 0.15 {
PathingResult::TravelTo(*next)
} else { } else {
PathingResult::Travelling PathingResult::Travelling
} }
......
...@@ -49,6 +49,9 @@ pub fn tick_travelling_merchant( ...@@ -49,6 +49,9 @@ pub fn tick_travelling_merchant(
PathingResult::NextNode => { PathingResult::NextNode => {
path.increment_indexes(); path.increment_indexes();
} }
PathingResult::TravelTo(new_point) => {
transform.translation = new_point.extend(transform.translation.z);
}
PathingResult::Travelling => {} PathingResult::Travelling => {}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment