mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
make the timer trigger (#935)
Co-authored-by: Tony <mostlyharmless@riseup.net>
This commit is contained in:
parent
ec8fd57c45
commit
01c4dd96cf
1 changed files with 3 additions and 1 deletions
|
@ -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 a new issue