Skip to content

Commit 01c4dd9

Browse files
rmsthebestTony
andauthored
make the timer trigger (#935)
Co-authored-by: Tony <[email protected]>
1 parent ec8fd57 commit 01c4dd9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/2d/sprite_sheet.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ fn main() {
99
}
1010

1111
fn animate_sprite_system(
12+
time: Res<Time>,
1213
texture_atlases: Res<Assets<TextureAtlas>>,
1314
mut query: Query<(&mut Timer, &mut TextureAtlasSprite, &Handle<TextureAtlas>)>,
1415
) {
15-
for (timer, mut sprite, texture_atlas_handle) in query.iter_mut() {
16+
for (mut timer, mut sprite, texture_atlas_handle) in query.iter_mut() {
17+
timer.tick(time.delta_seconds);
1618
if timer.finished() {
1719
let texture_atlas = texture_atlases.get(texture_atlas_handle).unwrap();
1820
sprite.index = ((sprite.index as usize + 1) % texture_atlas.textures.len()) as u32;

0 commit comments

Comments
 (0)