veggis Posted October 1, 2017 Share Posted October 1, 2017 I have a class that extends phaser.sprite, and in update i want to do something to the object that its body is touching. Is there a way to get the sprite/object from body.touching? .. If that makes sense. Link to comment Share on other sites More sharing options...
Cudabear Posted October 2, 2017 Share Posted October 2, 2017 I'm pretty sure body.touching never cares to check to see what it's touching. In order to do this, you'll probably want to add all the sprites that you want to affect by touching to a group, then call game.physics.arcade.collide(sprite, group, function(sprite, collidedSpriteFromGroup) { //affect collidedSpriteFromGroup here }); inside your update loop. This example uses overlap instead of collide, but it's effectively the same thing:http://phaser.io/examples/v2/arcade-physics/custom-sprite-vs-group samme 1 Link to comment Share on other sites More sharing options...
Recommended Posts