diff --git a/src/lib.rs b/src/lib.rs index 9300266..2904196 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,6 +47,8 @@ impl Plugin for AsteroidPlugin { wrap_entities, asteroids::tick_asteroid_manager, asteroids::spawn_asteroid.after(asteroids::tick_asteroid_manager), + // TODO: Remove debug printing + debug_collision_event_printer, ) .run_if(in_state(GameState::Playing)), ) @@ -60,6 +62,12 @@ impl Plugin for AsteroidPlugin { } } +fn debug_collision_event_printer(mut collision_events: EventReader) { + for event in collision_events.read() { + dbg!(event); + } +} + #[derive(Clone, Debug, Eq, Hash, PartialEq, States)] pub enum GameState { TitleScreen, // Program is started. Present title screen and await user start @@ -185,6 +193,8 @@ fn spawn_player(mut commands: Commands, game_assets: Res) { .spawn(( Collider::ball(0.7), Sensor, + ActiveEvents::COLLISION_EVENTS, + ActiveCollisionTypes::STATIC_STATIC, Ship, Wrapping, Position(Vec2::default()),