From f98dcf9582418de9c4dc888ca78e88f4c0471be8 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Sun, 4 Apr 2021 12:47:43 +0200 Subject: good start, but seem to have an issue with queries connecting cells and textureatlassprite, their iters are always empty --- src/cell.rs | 6 ++- src/main.rs | 141 +++++++++++++++++++++++++++++------------------------------- 2 files changed, 72 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/cell.rs b/src/cell.rs index 51b68e8..b697076 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -76,10 +76,12 @@ pub fn insert(mut q: Query<(&mut Cell, &mut TextureAtlasSprite)>) { } } -pub fn start_explosion(commands: &mut Commands, mut q: Query<(Entity, &Cell), Without>) { +pub fn start_explosion(mut commands: Commands, mut q: Query<(Entity, &Cell), Without>) { for (entity, cell) in q.iter_mut() { if cell.occupant == Occupant::Explosion { - commands.insert(entity, (Timer::from_seconds(0.1, true),)); + commands + .entity(entity) + .insert(Timer::from_seconds(0.1, true)); } } } diff --git a/src/main.rs b/src/main.rs index 79c0f2b..1c1d49a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,36 +3,38 @@ use bevy::prelude::*; use gems::cell::{self, Cell, Occupant}; use gems::constants; use rand::{thread_rng, Rng}; +use std::time::Duration; -fn star_spawning_system(commands: &mut Commands, time: Res