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