Jump to content

How can I check if a sprite is within another sprite?


Recommended Posts

Dear community,


I am trying to move my player object towards my mouse and am trying to achieve that if the player colllides with a group of sprites (stars) that the star in the group of stars is deleted. The thing is, I only want this to happen if the player entirely covers the star. Both stars and players use the P2JS physics. I wonder if this is needed. So I have 2 problems now.


First I used arcade and i could easily move my player with the mouse. How can I do this in p2JS?

Since Im now using p2JS because of circle colliders, how can i check if another circle (star) is within the larger circle (the player)?

Link to comment
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.
  • Create New...