Log In  

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?

P#84575 2020-11-21 18:39 ( Edited 2020-11-22 12:27)

mget(x,y) is possibly what you are looking for?

i would personally recommend a table that is scanned from the map so you can do proper pythagoras to them however.

(at the start of a level just make an empty table, loop through every map tile, then add the positions to the table, use pythagoras to see if the player is close, and get the nearest)

P#84624 2020-11-23 10:29

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-11-24 01:11 | 0.010s | 2097k | Q:16