diff options
Diffstat (limited to 'ecs/examples')
-rw-r--r-- | ecs/examples/multiple_queries.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ecs/examples/multiple_queries.rs b/ecs/examples/multiple_queries.rs index ed02a69..e914cc6 100644 --- a/ecs/examples/multiple_queries.rs +++ b/ecs/examples/multiple_queries.rs @@ -32,18 +32,18 @@ impl Display for EnemyName fn do_attacks( attacker_query: Query<(AttackStrength,)>, - mut enemy_query: Query<(Health, EnemyName)>, + enemy_query: Query<(Health, EnemyName)>, ) { for (attack_strength,) in &attacker_query { - for (health, enemy_name) in enemy_query.iter_mut() { - let damage = match attack_strength { + for (mut health, enemy_name) in &enemy_query { + let damage = match *attack_strength { AttackStrength::Strong => 20, AttackStrength::Weak => 10, }; if health.health <= damage { - println!("Enemy '{enemy_name}' died"); + println!("Enemy '{}' died", *enemy_name); health.health = 0; @@ -52,7 +52,7 @@ fn do_attacks( health.health -= damage; - println!("Enemy '{enemy_name}' took {damage} damage"); + println!("Enemy '{}' took {damage} damage", *enemy_name); } } } |