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 @@
.idea/
.vscode/
dist/
\ No newline at end of file
dist/
artifacts/
\ No newline at end of file
......@@ -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()
},
......
......@@ -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
}
......
......@@ -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 => {}
}
}
......
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