0 votes

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

in Engine by (114 points)

1 Answer

0 votes
Best answer

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 https://godotengine.org/qa/9725/getting-intersect_point-to-work?show=9754#a9754

by (7,896 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.