ensure particle are always behind characters
This commit is contained in:
parent
9fd54a5755
commit
4af0642b16
2 changed files with 10 additions and 1 deletions
10
src/game.rs
10
src/game.rs
|
@ -124,16 +124,24 @@ pub fn spawn_characters<I: IntoIterator<Item = (Transform, Color)>>(
|
|||
|
||||
characters: I,
|
||||
) {
|
||||
const Z_INCREMENT: f32 = 0.01;
|
||||
let mut curr_z: f32 = Z_INCREMENT;
|
||||
|
||||
for (i, (transform, color)) in characters.into_iter().enumerate() {
|
||||
spawn_character(
|
||||
commands,
|
||||
character_meshes,
|
||||
materials,
|
||||
audio,
|
||||
transform,
|
||||
{
|
||||
let mut new_transform: Transform = transform;
|
||||
new_transform.translation.z = curr_z;
|
||||
new_transform
|
||||
},
|
||||
color,
|
||||
i == 0,
|
||||
);
|
||||
curr_z += Z_INCREMENT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,5 +134,6 @@ fn particle_effect_system(
|
|||
/ particle_effect.radius_squared,
|
||||
);
|
||||
}
|
||||
transform.translation.z = 0.005;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue