From 0627722906906c9523b6adac44d09fb14f2c51fe Mon Sep 17 00:00:00 2001 From: Nixon Date: Sat, 27 Aug 2022 21:30:28 +0800 Subject: [PATCH] move collision_event_system to after platform_collision_event_system --- src/game.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/game.rs b/src/game.rs index eb858eb..9fc323d 100644 --- a/src/game.rs +++ b/src/game.rs @@ -59,7 +59,8 @@ impl Plugin for GamePlugin { ) .add_system_to_stage(CoreStage::PostUpdate, char_char_collision_event_system) .add_system_to_stage(CoreStage::PostUpdate, char_platform_collision_event_system) - .add_system_to_stage(CoreStage::PostUpdate, collision_event_system); + // collision event system might remove items, therefore, we should detect platforms first before removing them + .add_system_to_stage(CoreStage::PostUpdate, collision_event_system.after(char_platform_collision_event_system)); } } @@ -111,12 +112,10 @@ pub struct PlatformCount(usize); impl PlatformCount { fn increment(&mut self) { - println!("increment"); self.0 += 1; } fn decrement(&mut self) { - println!("decrement"); self.0 = self.0.saturating_sub(1); }