Best approach to get clicked objects from a display list (2D)

Posted by Ixx on Game Development See other posts from Game Development or by Ixx
Published on 2012-03-21T10:45:19Z Indexed on 2012/03/21 11:39 UTC
Read the original article Hit count: 252

Filed under:
|
|

I'm implementing a display list to manage my visuals on screen.

I want to know which object is clicked.

My objects already have z-order variable.

With my current knowledge (almost nothing) the only thing which comes to my mind is make a linear search and get all the objects which contains the clicked point. And then select the object with the highest z-order. But I know there are far better approaches.

I think it's something with trees (binary search?). - container display objects and search recursively?

just don't know where to start looking, for this concrete case. Any hint link or concrete solution is welcome.

© Game Development or respective owner

Related posts about 2d

Related posts about algorithm