My Evil Pony Posted October 12, 2017 Share Posted October 12, 2017 Hello guys. Please help. Is it possible to check that my sprite has been overlapped by another sprite in this group ? Something like this if ( mySprite.overlap(groupOfMySprites) ) { // do something with mySprite } Thanks for answer. Link to comment Share on other sites More sharing options...
samme Posted October 12, 2017 Share Posted October 12, 2017 examples/v2/arcade-physics/sprite-vs-group. Like that but use overlap. Link to comment Share on other sites More sharing options...
My Evil Pony Posted October 12, 2017 Author Share Posted October 12, 2017 Need to check not only collision. There is important difference beetwen sprites, that have been overlapped, and sprites, that have overlapped another sprites. Im my task i need to check if my sprite had been overlapped by any another sprite. Link to comment Share on other sites More sharing options...
Cudabear Posted October 13, 2017 Share Posted October 13, 2017 You can pass a group as the arcade physics overlap function. https://photonstorm.github.io/phaser-ce/Phaser.Physics.Arcade.html#overlap That said, you need arcade physics on all sprites within the group as well as the sprite you want to check against the group. If you feel you don't need physics on the group's sprites, check this example: https://www.phaser.io/examples/v2/sprites/overlap-without-physics Also, for future reference, you can forEach any group do custom work on each of its elements independently, just like a vanilla javascript array. Link to comment Share on other sites More sharing options...
Recommended Posts