Compare commits

..

No commits in common. "160e881ba74a6b734000c75c614a830c82346491" and "d03308136e8ebc6bb8953c93977d8e5e21fb7a06" have entirely different histories.

2 changed files with 3 additions and 28 deletions

View file

@ -23,10 +23,6 @@ impl PassThroughFilter {
PassThroughFilter::Rotating(filter_angle) => { PassThroughFilter::Rotating(filter_angle) => {
let mut hsla = color.as_hsla_f32(); let mut hsla = color.as_hsla_f32();
hsla[0] = (hsla[0] + filter_angle) % 360.; hsla[0] = (hsla[0] + filter_angle) % 360.;
// floating rem is not modulo!
if hsla[0] < 0. {
hsla[0] += 360.;
}
Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3]) Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3])
} }
} }

View file

@ -25,7 +25,6 @@ pub struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_event::<LevelStartupEvent>() app.add_event::<LevelStartupEvent>()
.add_event::<ChangeCharacterEvent>()
.init_resource::<CharacterMeshes>() .init_resource::<CharacterMeshes>()
.insert_resource(CurrentLevel(None)) .insert_resource(CurrentLevel(None))
.init_resource::<CharacterList>() .init_resource::<CharacterList>()
@ -42,8 +41,7 @@ impl Plugin for GamePlugin {
.with_system(player_movement_system) .with_system(player_movement_system)
.with_system(level_keyboard_system) .with_system(level_keyboard_system)
.with_system(camera_system) .with_system(camera_system)
.with_system(character_particle_effect_system) .with_system(character_particle_effect_system),
.with_system(kill_character_system),
) )
.add_system_set( .add_system_set(
SystemSet::on_update(AppState::Win) SystemSet::on_update(AppState::Win)
@ -67,8 +65,6 @@ impl Plugin for GamePlugin {
pub struct LevelStartupEvent; pub struct LevelStartupEvent;
pub struct ChangeCharacterEvent;
// Resources // Resources
pub struct CurrentLevel(pub Option<LevelId>); pub struct CurrentLevel(pub Option<LevelId>);
@ -439,14 +435,14 @@ fn collision_event_system(
fn change_character_system( fn change_character_system(
mut commands: Commands, mut commands: Commands,
keyboard_input: Res<Input<KeyCode>>, keyboard_input: Res<Input<KeyCode>>,
characters: Query<(Entity, &CharacterColor, Option<&Player>)>, characters: Query<(Entity, &CharacterColor, Option<&Player>)>,
character_list: Res<CharacterList>, character_list: Res<CharacterList>,
audio_assets: Res<audio_system::AudioAssets>, audio_assets: Res<audio_system::AudioAssets>,
audio: Res<Audio>, audio: Res<Audio>,
change_character_event: EventReader<ChangeCharacterEvent>,
) { ) {
if !keyboard_input.just_pressed(KeyCode::Tab) && change_character_event.is_empty() { if !keyboard_input.just_pressed(KeyCode::Tab) {
return; return;
} }
@ -627,20 +623,3 @@ fn level_keyboard_system(
} }
} }
} }
fn kill_character_system(
mut commands: Commands,
character_query: Query<(Entity, &Transform, Option<&Player>), With<CharacterColor>>,
mut character_list: ResMut<CharacterList>,
mut change_character_event: EventWriter<ChangeCharacterEvent>,
) {
for (entity, transform, player) in character_query.iter() {
if transform.translation.y < -512. {
commands.entity(entity).despawn_recursive();
character_list.0.remove(&entity);
if player.is_some() {
change_character_event.send(ChangeCharacterEvent);
}
}
}
}