phaser 3 sprites with random x,y but in a specific area

Recommended Posts

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?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.