Skip to content

Commit

Permalink
Rebased on main
Browse files Browse the repository at this point in the history
  • Loading branch information
ManevilleF committed Dec 12, 2022
1 parent 245e9a9 commit 52396bf
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions examples/2d/sprite_sheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ struct AnimationTimer(Timer);

fn animate_sprite(
time: Res<Time>,
mut query: Query<(
&AnimationIndices,
&mut AnimationTimer,
&mut TextureAtlas,
)>,
mut query: Query<(&AnimationIndices, &mut AnimationTimer, &mut TextureAtlas)>,
) {
for (indices, mut timer, mut atlas) in &mut query {
timer.tick(time.delta());
Expand All @@ -50,13 +46,13 @@ fn setup(
let texture_atlas = texture_atlases.add(atlas);
// Use only the subset of sprites in the sheet that make up the run animation
let animation_indices = AnimationIndices { first: 1, last: 6 };
commands.spawn_bundle(Camera2dBundle::default());
commands
.spawn_bundle(SpriteSheetBundle {
commands.spawn(Camera2dBundle::default());
commands.spawn((
SpriteSheetBundle {
texture,
atlas: TextureAtlas {
layout: texture_atlas,
index: 0,
index: animation_indices.first,
},
transform: Transform::from_scale(Vec3::splat(6.0)),
..default()
Expand Down

0 comments on commit 52396bf

Please sign in to comment.