kipppys Posted September 25, 2014 Share Posted September 25, 2014 what im trying to do is create a bunch of different maps for a rouge like game and i want the game code to pick up where i place the player tile that will look like a normal tile with a different id and then place the player at that position instead of holding a bunch of position for each map just curious if its possible i assume it is but i could use some help guys Link to comment Share on other sites More sharing options...
sharbelfs Posted September 25, 2014 Share Posted September 25, 2014 i don't know if there is an easier way, but i used Tilemap.searchTileIndex(index) to search the tile by the index, than you can get the position of the tile Link to comment Share on other sites More sharing options...
JUL Posted September 25, 2014 Share Posted September 25, 2014 sharbelfs method looks nice for a quick placing but doing it over and over again for various stuffs (player, bots, objects, doors, whatever) might be not that great. here's the lame way I use, it's cheap but it works var botSpawnTile=42; var mapArray = layer.getTiles(0, 0, game.world.width, game.world.height); for(var i=0;i<mapArray.length;i++){ var myTile=mapArray; if(myTile.index==botSpawnTile){ //doSomething } } But only on create, on update would be a bad idea Link to comment Share on other sites More sharing options...
kipppys Posted September 26, 2014 Author Share Posted September 26, 2014 thanks guys il try these out later Link to comment Share on other sites More sharing options...
kipppys Posted September 28, 2014 Author Share Posted September 28, 2014 i don't know if there is an easier way, but i used Tilemap.searchTileIndex(index) to search the tile by the index, than you can get the position of the tile that worked perfectly thanks bro Link to comment Share on other sites More sharing options...
Recommended Posts