diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-24 15:01:04 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-24 15:01:04 +0100 |
commit | 876fd9d60de9c09e8657a2cb70fd55fd041d1f97 (patch) | |
tree | 8d30385f6b795f706888b036e30506e51985f922 /src/client.rs | |
parent | f7428e317d282856d05ffc37b6ba474c5e9973ce (diff) |
feat: color projectiles
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client.rs b/src/client.rs index 12f12c0..d536dce 100644 --- a/src/client.rs +++ b/src/client.rs @@ -230,9 +230,9 @@ fn render_projectiles( mut commands: Commands, mut materials: ResMut<Assets<ColorMaterial>>, mut meshes: ResMut<Assets<Mesh>>, - projectiles: Query<(Entity, &Projectile), Added<Projectile>>, + projectiles: Query<(Entity, &Projectile, &ProjectileColor), Added<Projectile>>, ) { - for (entity, projectile) in projectiles.iter() { + for (entity, projectile, projectile_color) in projectiles.iter() { let Some(position) = (match projectile.type_ { ProjectileType::Free(FreeProjectile { position, .. }) => Some(position), ProjectileType::Instant(InstantProjectile { .. }) => None, @@ -241,8 +241,8 @@ fn render_projectiles( continue; }; commands.entity(entity).insert(MaterialMesh2dBundle { - mesh: Mesh2dHandle(meshes.add(Circle { radius: 2. })), - material: materials.add(Color::RED), + mesh: Mesh2dHandle(meshes.add(Circle { radius: 1. })), + material: materials.add(projectile_color.0), transform: Transform::from_xyz(position.x, position.y, 1.), ..Default::default() }); |