Phaser P2 Physics check for collision with specific tile

Datetime:2016-08-22 23:08:37         Topic:         Share        Original >>
Here to See The Original Article!!!


I'm tearing my hair out trying to figure this out. I have a tilemap made in Tiled. Everything is displaying correctly and the player is colliding correctly. I want to check whether or not the player is colliding with a certain tile (for example, a water tile or a spike tile) and if so, kill the player.

I've done a lot of searching and so far I've tried:

  • setTileIndexCallback: this has had absolutely no effect. I can't get the console message to show at all.
  • Collision groups: I've set the collision groups for the player and the tilemap but that didn't seem to do anything

I'm not sure what to do.

Put your ads here, just $200 per month.