Add frame count to tiles prior
parent
a61b799c72
commit
5f8bd8c87b
|
@ -285,9 +285,12 @@ pub fn get_sprites( tilemap: &TiledTilemap, sprite_ids: &HashMap<String, u16> )
|
|||
let sprite_id = sprite_ids.get( &sprite_metadata.id ).ok_or( format!( "invalid file: undefined sprite id \"{}\"", sprite_metadata.id ) )?;
|
||||
result.extend( sprite_id.to_be_bytes() );
|
||||
|
||||
let tiles_across = sprite.image.width() / 8;
|
||||
let frames: u16 = ( tiles_across / ( sprite_metadata.width as u32 ) ) as u16;
|
||||
|
||||
let tile_index_location = tiles_before + tiles_after;
|
||||
result.extend( ( tile_index_location as u16 ).to_be_bytes() );
|
||||
tiles_after += ( sprite_metadata.width * sprite_metadata.height ) as u32;
|
||||
tiles_after += ( ( sprite_metadata.width as u16 * sprite_metadata.height as u16 ) * frames ) as u32;
|
||||
|
||||
result.push( sprite_metadata.width );
|
||||
|
||||
|
@ -297,8 +300,6 @@ pub fn get_sprites( tilemap: &TiledTilemap, sprite_ids: &HashMap<String, u16> )
|
|||
|
||||
// One animation per .tsx file
|
||||
// Animations run like a filmstrip across, never down
|
||||
let tiles_across = sprite.image.width() / 8;
|
||||
let frames: u16 = ( tiles_across / ( sprite_metadata.width as u32 ) ) as u16;
|
||||
result.extend( frames.to_be_bytes() );
|
||||
|
||||
if let Some( jiffies ) = sprite_metadata.anim_interval {
|
||||
|
|
Loading…
Reference in New Issue