Skip to content

Commit

Permalink
constrain follow_player camera system to after player movement
Browse files Browse the repository at this point in the history
  • Loading branch information
thombruce committed Oct 28, 2023
1 parent d09422e commit ee8d7af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions src/ui/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ 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 {
fn build(&self, app: &mut App) {
// 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)),
);
}
}

Expand Down

0 comments on commit ee8d7af

Please sign in to comment.