jmp909 Posted October 29, 2015 Share Posted October 29, 2015 I have a tilemap and i want the tiles on one layer to be collectible. converting it all to sprites causes too much slowdown I manage to get p2 collisions but the problem with the (unoptimized) tilemap conversion is there's no link between the physics body and the tile it representsvar collectibles = this.game.physics.p2.convertTilemap(map, this.layer1,true,false)just returns p2 bodies and no relevant tile data Is there a way to get the tile related to a p2 body? i ended up cheating and doing this. but it's not perfect....overlap=8this.map.removeTileWorldXY(this.player.position.x, this.player.position.y,32,32,this.layer1)this.map.removeTileWorldXY(this.player.position.x-overlap, this.player.position.y-overlap,32,32,this.layer1)this.map.removeTileWorldXY(this.player.position.x+overlap, this.player.position.y-overlap,32,32,this.layer1)this.map.removeTileWorldXY(this.player.position.x-overlap, this.player.position.y+overlap,32,32,this.layer1)this.map.removeTileWorldXY(this.player.position.x+overlap, this.player.position.y+overlap,32,32,this.layer1)thanks for any suggestionsJ Link to comment Share on other sites More sharing options...
Recommended Posts