pros22su Posted November 24, 2014 Share Posted November 24, 2014 Hi,I am using the same approach in my game to make items collectible in my game as in this example: http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=tile+callbacks.js&t=tile%20callbacks Coins are added to tilemap and tile callback functions are used. Let's say I have a door that will be opened after all coins are collected. Is there a way to count how many coins are on the map using tile ID or tile custom property? Link to comment Share on other sites More sharing options...
pros22su Posted November 25, 2014 Author Share Posted November 25, 2014 (edited) I had a closer look into and the final result is:findTilesByProperty: function(property, value, layer) { var result = []; layer.layer.data.forEach(function (v) { v.forEach(function (tile) { if(tile.properties[property] === value) { result.push(tile); } }); }); return result;} Edited November 27, 2014 by pros22su Link to comment Share on other sites More sharing options...
Recommended Posts