j0hnskot Posted May 30, 2014 Share Posted May 30, 2014 I created a double layer tilemap and i tried to set a callback when the player touches a specific tile. I put one of the mentioned tile on each layer and i used this: map = game.add.tilemap('map');map.addTilesetImage('spritesheet');layer= map.createLayer('Tile Layer 1');layer2= map.createLayer('Tile Layer 2');map.setTileIndexCallback(2, tileProperties, this);It touches the tile on the first layer and works fine.Then i use :map.setTileIndexCallback(2, tileProperties, this,layer2);But the callback does not work. Is there a way to make such callbacks on other layers besides the first?What am i doing wrong? Link to comment Share on other sites More sharing options...
TomFiveThumbs Posted June 4, 2014 Share Posted June 4, 2014 Trymap.setTileIndexCallback(2, tileProperties, this, 'Tile Layer 2');instead of map.setTileIndexCallback(2, tileProperties, this,layer2); Link to comment Share on other sites More sharing options...
j0hnskot Posted June 4, 2014 Author Share Posted June 4, 2014 tried, no luck. I guess the callback happens only when the tile is directly touched by collision,overlap etc. I'll work my way around. If this is not true, someone correct me. Link to comment Share on other sites More sharing options...
TomFiveThumbs Posted June 4, 2014 Share Posted June 4, 2014 I guess the callback happens only when the tile is directly touched by collision,overlap etc That's right. There needs to be some kind of interaction to fire the callback. Link to comment Share on other sites More sharing options...
Recommended Posts