File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ namespace pxt.sprite {
248248 export function decodeTilemap ( literal : string , fileType : "typescript" | "python" , proj : TilemapProject ) : TilemapData {
249249 literal = Util . htmlUnescape ( literal ) . trim ( ) ;
250250
251- if ( ! literal . trim ( ) ) {
251+ if ( ! literal . trim ( ) || literal . indexOf ( "(" ) === - 1 ) {
252252 return null ;
253253 }
254254
Original file line number Diff line number Diff line change @@ -1683,9 +1683,17 @@ namespace pxt {
16831683 const tmWidth = bytes [ 1 ] | ( bytes [ 2 ] << 8 ) ;
16841684 const tmHeight = bytes [ 3 ] | ( bytes [ 4 ] << 8 ) ;
16851685
1686+ const tiles : Tile [ ] = jres . tileset . map ( id => ( resolveTile && resolveTile ( id ) ) || { id } as any ) ;
1687+ let tileWidth = bytes [ 0 ] ;
1688+
1689+ if ( ! tileWidth ) {
1690+ tileWidth = tiles . length && tiles . find ( t => t . bitmap ?. width ) ?. bitmap . width ;
1691+ }
1692+ tileWidth = tileWidth || 16 ;
1693+
16861694 const tileset : TileSet = {
1687- tileWidth : bytes [ 0 ] ,
1688- tiles : jres . tileset . map ( id => ( resolveTile && resolveTile ( id ) ) || { id } as any )
1695+ tileWidth,
1696+ tiles
16891697 } ;
16901698
16911699 const tilemapStart = 5 ;
You can’t perform that action at this time.
0 commit comments