File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -491,6 +491,41 @@ Phaser.TilemapParser = {
491491
492492 }
493493
494+ // assign tile properties
495+
496+ var i , j , k ;
497+ var layer , tile , sid , set ;
498+
499+ // go through each of the map layers
500+ for ( i = 0 ; i < map . layers . length ; i ++ )
501+ {
502+ layer = map . layers [ i ] ;
503+
504+ // rows of tiles
505+ for ( j = 0 ; j < layer . data . length ; j ++ )
506+ {
507+ row = layer . data [ j ] ;
508+
509+ // individual tiles
510+ for ( k = 0 ; k < row . length ; k ++ )
511+ {
512+ tile = row [ k ] ;
513+
514+ if ( tile . index < 0 ) { continue ; }
515+
516+ // find the relevant tileset
517+ sid = map . tiles [ tile . index ] [ 2 ] ;
518+ set = map . tilesets [ sid ] ;
519+
520+ // if that tile type has any properties, add them to the tile object
521+ if ( set . tileProperties && set . tileProperties [ tile . index - set . firstgid ] ) {
522+ tile . properties = set . tileProperties [ tile . index - set . firstgid ] ;
523+ }
524+ }
525+ }
526+ }
527+
528+
494529 return map ;
495530
496531 }
You can’t perform that action at this time.
0 commit comments