uri Posted July 3, 2015 Share Posted July 3, 2015 Hi, I want to replace the tiles below the player as the he moves here is my try: var x = player_pos.x + this.player.getWidth()/2;var y = player_pos.y + this.player.getHeight()/2 +10;var tile = this.map.getTileWorldXY(x, y, 16, 16, this.blockedLayer);if (tile != null){ this.map.replace(2, 1, tile.x, tile.y, tile.width, tile.height, this.blockedLayer);}this replaces some tiles, but not the expected ones I'm not sure how to get the exact tile below the player and if the parameters of replace are correct Do you have any hints for me? Tilde 1 Link to comment Share on other sites More sharing options...
uri Posted July 3, 2015 Author Share Posted July 3, 2015 Ok, I've solved it, with x and y I use removeTileWorldXY and putTileWorldXYthis.map.removeTileWorldXY(x, y, tile.width, tile.height, this.blockedLayer);this.map.putTileWorldXY(1, x, y, tile.width, tile.height, this.blockedLayer); Tilde 1 Link to comment Share on other sites More sharing options...
Recommended Posts