From ee8d7af1d4a5fa554d6d4eb34c74f23a4140dc75 Mon Sep 17 00:00:00 2001 From: Thom Bruce Date: Sat, 28 Oct 2023 16:20:59 +0100 Subject: [PATCH] constrain follow_player camera system to after player movement --- CHANGELOG.md | 4 ++++ src/ui/camera.rs | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe63ca3..9d25787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- follow_player camera system now constrained to .after() player movement + ## [0.0.18] - 2023-10-26 ### Added diff --git a/src/ui/camera.rs b/src/ui/camera.rs index 694c1ec..78a5683 100644 --- a/src/ui/camera.rs +++ b/src/ui/camera.rs @@ -6,7 +6,10 @@ use crate::shaders::{ pixelate::{PixelatePlugin, PixelateSettings}, }; -use crate::{core::resources::state::GameState, ships::player::Player}; +use crate::{ + core::resources::state::GameState, + ships::player::{player_flight_system, Player}, +}; pub struct CameraPlugin; impl Plugin for CameraPlugin { @@ -14,7 +17,16 @@ impl Plugin for CameraPlugin { // app.add_plugins(PixelatePlugin); // app.add_plugins(ChromaticAberrationPlugin); app.add_systems(Startup, setup); - app.add_systems(Update, follow_player.run_if(in_state(GameState::Active))); + app.add_systems( + Update, + follow_player + // TODO: player_flight_system won't always be the only player control system + // Consider creating a SystemSet for the player control step (whatever + // it may be for the given GameState) and executing the follow_player + // system after that SystemSet. + .after(player_flight_system) + .run_if(in_state(GameState::Active)), + ); } }