DemitriyDN Posted June 6, 2017 Share Posted June 6, 2017 Hi to all. i've just started learn how to do simple staff on Phaser + Box2D My question is: In `Arcade` physics we have next: I draw "coin" on a tilemap and then do map.setTileIndexCallback(26, hitCoin, this); Such behaviour allows me to draw coins inside tilemap But when i started using 'box2d' physics in tutorials i found only next: We should draw tilemap without coins and then add group of coins inside code: var coins = game.add.group(); coins.enableBody = true; coins.physicsBodyType = Phaser.Physics.BOX2D; for (var i = 0; i < 2; i++) { var sprite = coins.create(100 * (i+1), 200, 'coin'); sprite.body.setCollisionCategory(26); sprite.body.gravityScale = false; sprite.body.sensor = true; } then use something like: ball.body.setCategoryContactCallback(26, hitCoin, this); I really do not like such implementation - because in the future i should manually specify position of each coin. Is there a way to detect tile overlap for BOX2D physics? Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts