You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(with the caveat that I'm using the as-of-yet unmerged #45 PR since I'm on 0.15 and that this may not have been a problem in the earlier versions)
I tried using this crate for the first time and wanted to use animated tiles, but I noticed that a frame was always missing from the animation in Bevy compared to in Tiled. I looked through the relevant code and noticed that the AnimatedTile is created using last_tile.tile_id as its end value:
speed:1000. / first_tile.durationasf32,// duration is in ms and we want a 'frames per second' speed
})
The documentation for AnimatedTile::end is "The end frame index in the tilemap atlas/array (exclusive)." That "exclusive" made me think that it might be necessary to add 1 to the last_tile.tile_id since we want to include the last tile of the animation that Tiled provides to us, not exclude it. And sure enough, by changing the code above to
Some(AnimatedTile{start: first_tile.tile_id,end: last_tile.tile_id + 1,// added a `+ 1` herespeed:1000. / first_tile.durationasf32,// duration is in ms and we want a 'frames per second' speed})
my animated tiles are suddenly not missing tiles/frames anymore.
The text was updated successfully, but these errors were encountered:
(with the caveat that I'm using the as-of-yet unmerged #45 PR since I'm on 0.15 and that this may not have been a problem in the earlier versions)
I tried using this crate for the first time and wanted to use animated tiles, but I noticed that a frame was always missing from the animation in Bevy compared to in Tiled. I looked through the relevant code and noticed that the
AnimatedTile
is created usinglast_tile.tile_id
as itsend
value:bevy_ecs_tiled/src/loader.rs
Lines 578 to 582 in 86e489a
The documentation for
AnimatedTile::end
is "The end frame index in the tilemap atlas/array (exclusive)." That "exclusive" made me think that it might be necessary to add 1 to thelast_tile.tile_id
since we want to include the last tile of the animation that Tiled provides to us, not exclude it. And sure enough, by changing the code above tomy animated tiles are suddenly not missing tiles/frames anymore.
The text was updated successfully, but these errors were encountered: