So, I'm modding a game called Andy the Adventurer and making it into more of a spider man style thing. I want the player to be able to grab onto ledges. I've already made the code for making the player go up by four pixels, but what I need to do is get the coordinates of the nearest instance of a certain sprite. Closest to the player that is. It's the most efficient way to do it I think. I have a sprite specifically for ledge grabbing, and it's invisible. In the map editor, I place it directly next to any steep ledges. So yeah.
TLDR: How do I check the top-left corner location of the nearest instance of a sprite, to the player?
Still long, but better.
EDIT: I suppose a better question would be, how do I check if an x,y coordinate is inside a certain sprite on the map?