Jump to content

Determine sprite directly under another sprite


ptotheaul
 Share

Recommended Posts

I have a game where a sprite(ball) is dropped and then I need to determine what the sprite(object) is directly under it is,  where there are a lot of object sprites.   If an object sprite covers another object sprite I would only want the top object sprite to be detected(ideally if the ball sprite overlapped the visible area of multiple object sprites I would like all of the of the ball/objects detections to show).

I've looked into .intersects and even just using a single point with .contains but can't figure it out.  If I check for collisions is there a way to just check for the visible(not covered up by other sprite) area?

 

Link to comment
Share on other sites

The ball is not moving.  it just gets placed in a certain spot.  I've tried using overlapping but it returns every object that the ball overlaps with and I just want it to return the object that is on the top(or ideally the objects that are not covered by another oject).

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...