For better gravity have variables Y and YSpeed.
Instead of increasing Y, increase YSpeed and then increase Y by YSpeed, so the character accellarates downwards, because the downward force is being continually increased.
With this then you could let the player jump by giving them upward force.
Here is an example:
if ( YPos < 440 ) // if player is in the air
YSpeed += 0.5; // 0.5 being the force of gravity
YPos += YSpeed; // update position
if ( YPos > 440 ) // if player is below ground level
{
YSpeed = 0; // they stop falling
YPos = 440; // they stay at ground level
}
if ( ( YPos == 440 ) && ( dbSpaceKey ( ) == 1 ) ) // if they are on the ground and they jumping
YSpeed = -10; // -10 being the jumping power
The ground height (that I have set to 440) will vary depending on the X position if you have platforms.