make the timer trigger (#935)
Co-authored-by: Tony <mostlyharmless@riseup.net>
This commit is contained in:
parent
ec8fd57c45
commit
01c4dd96cf
@ -9,10 +9,12 @@ fn main() {
|
||||
}
|
||||
|
||||
fn animate_sprite_system(
|
||||
time: Res<Time>,
|
||||
texture_atlases: Res<Assets<TextureAtlas>>,
|
||||
mut query: Query<(&mut Timer, &mut TextureAtlasSprite, &Handle<TextureAtlas>)>,
|
||||
) {
|
||||
for (timer, mut sprite, texture_atlas_handle) in query.iter_mut() {
|
||||
for (mut timer, mut sprite, texture_atlas_handle) in query.iter_mut() {
|
||||
timer.tick(time.delta_seconds);
|
||||
if timer.finished() {
|
||||
let texture_atlas = texture_atlases.get(texture_atlas_handle).unwrap();
|
||||
sprite.index = ((sprite.index as usize + 1) % texture_atlas.textures.len()) as u32;
|
||||
|
Loading…
Reference in New Issue
Block a user