fix: menu, character despawn
This commit is contained in:
parent
d109225da6
commit
a52a3b84c8
4 changed files with 44 additions and 25 deletions
|
|
@ -1,7 +1,8 @@
|
|||
#![allow(clippy::precedence)]
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
use bevy::{
|
||||
ecs::world::EntityMut,
|
||||
input::{keyboard::KeyCode, Input},
|
||||
prelude::{shape::Quad, *},
|
||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
||||
|
|
@ -237,7 +238,7 @@ fn collision_event_system(
|
|||
mut commands: Commands,
|
||||
current_level: Res<CurrentLevel>,
|
||||
mut collision_events: EventReader<CollisionEvent>,
|
||||
mut character_query: Query<&CharacterId>,
|
||||
character_query: Query<&CharacterId>,
|
||||
mut level_query: Query<(&mut SelectedCharacterId, &mut CharacterIdList)>,
|
||||
) {
|
||||
if let Some(level_entity) = current_level.0 {
|
||||
|
|
@ -253,6 +254,7 @@ fn collision_event_system(
|
|||
if selected_character_id.0 == Some(*c2_id) {
|
||||
selected_character_id.0 = Some(*c1_id);
|
||||
}
|
||||
commands.entity(*e2).despawn_recursive();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue