This adds a smooth transition, so if the player is falling, it becomes easier to grab ledges.
Basically, if the player has a wall to its left or to its right, then check if the LedgeSprite has one too.
As it's above the player's head, if it doesn't, then there is a Ledge.
If the LedgeSprite neither has a wall to its left nor to its right, then set the gravity to 0
Else, set the gravity to its default value.
Also if the player neither has a wall to its right or its left, then, set the gravity back to its default value too.
Here, if the player is jumping and the all the Ledge grabbing conditions are verified, then make the player slowly get up the ledge.
The deceleration part is just here to avoid shakies when the player reaches the top.