pros22su Posted November 24, 2014 Report 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? Quote Link to comment Share on other sites More sharing options...
pros22su Posted November 25, 2014 Author Report 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.