I made a mode in my game that scrolls by and I want the player to be able to jump to the closest spot to him without jumping to a far away spot.
What the game looks like to give you an idea of what I want --http://imgur.com/0MXGXAP,6RjGwGX#0--
Here is my code for jumping to a spot atm --http://imgur.com/0MXGXAP,6RjGwGX#1--
Ignore the Y>700 because that is from another mode and will get changed once I figure out how to get the player from being able to si
I made the spots numbered based on where they are located but I want to make the player be forced to jump to the closest spot instead of being able to jump to the spot that is furthest away from him.