summaryrefslogtreecommitdiff
path: root/src/cell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 1659289..d5d19e2 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -76,32 +76,13 @@ pub fn insert(mut cell_query: Query<(&mut Cell, &mut TextureAtlasSprite)>) {
}
}
-pub fn explosion_animation(
- time: Res<Time>,
+pub fn start_explosion(
commands: &mut Commands,
- mut cell_query: Query<(
- Entity,
- &mut Cell,
- &mut TextureAtlasSprite,
- Option<&mut Timer>,
- )>,
+ mut cell_query: Query<(Entity, &Cell), Without<Timer>>,
) {
- for (entity, mut cell, mut sprite, timer) in cell_query.iter_mut() {
+ for (entity, cell) in cell_query.iter_mut() {
if cell.occupant == Occupant::Explosion {
- if let Some(mut timer) = timer {
- timer.tick(time.delta_seconds());
- if timer.finished() {
- if sprite.index < 7 && sprite.index >= 4 {
- sprite.index += 1;
- } else {
- cell.occupant = Occupant::None;
- sprite.index = cell.occupant.to_index();
- commands.remove_one::<Timer>(entity);
- }
- }
- } else {
- commands.insert(entity, (Timer::from_seconds(0.1, true),));
- }
+ commands.insert(entity, (Timer::from_seconds(0.1, true),));
}
}
}