Tommy_ Posted August 4, 2018 Share Posted August 4, 2018 I have some sprites in a group with random x,y. and i want those x,y be somewhere on my lets say ground area (which is a circle graphic object). what is the best way to do this? I was thinking about something like this: in update check if the sprite x,y overlap (contains) with ground or not, if they do let them be if they don't destroy them and make an other random x,y and so on. but since those sprites are too many and overlap area (ground) it's not that big it would effect on performance I guess(it will?). So is there a better way to do this? Link to comment Share on other sites More sharing options...
samme Posted August 4, 2018 Share Posted August 4, 2018 All the Phaser.Geom.* classes have contains methods. You can also use the Arcade Physics overlap methods, if you're worried about performance. Tommy_ 1 Link to comment Share on other sites More sharing options...
samid737 Posted August 5, 2018 Share Posted August 5, 2018 What about Phaser.Actions: https://labs.phaser.io/edit.html?src=src\actions\random circle.js 8Observer8 and Tommy_ 2 Link to comment Share on other sites More sharing options...
Recommended Posts