How can I get the sprite(s) at a particular point?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mydoghasworms
:warning: Old Version Published before Godot 3 was released.

As the question says, how can I get the sprite(s) at a particular location in 2D?

:bust_in_silhouette: Reply From: eons

Get all the sprites, iterate over them and check if their get_item_rect has_point with your point (rotations may affect the rect a lot).


Could be better if you use sprites for visual representations and areas for detections, the engine and your game may work better that way.

If you are interested on using Areas, look at this getting intersect_point() to work - Archive - Godot Forum