oxysoft Posted August 23, 2014 Share Posted August 23, 2014 I searched around the documentation and could not find how to do this. Is there an easy way to do this or do I have to create a 1x1 pixel sprite and check if it overlaps? It sounds really odd to me that phaser would not have this feature Thanks Link to comment Share on other sites More sharing options...
lewster32 Posted August 23, 2014 Share Posted August 23, 2014 A quick way to do it would be something like this:function getSpritesAtXY(group, x, y) { var location = new Phaser.Point(100, 100); var found = []; group.forEachExists(function(sprite) { if (Phaser.Rectangle.contains(sprite.getBounds(), location)) { found.push(sprite); } }); return found;}; Link to comment Share on other sites More sharing options...
Recommended Posts