Trouble with player jumping on 2D Gravity based map

So, I've recently been working on a side-view, 2D game using a 2D array for a map. So far, world generation, drawing, and everything else is working out great. I have simple gravity, which is:
1
2
3
4
5
if((map[myx][(int)myy+1]==0)&&lock==0)
		{
			map[myx][(int)myy]=mapc[myx][(int)myy];
			myy=myy+1;
		}

Just to clarify, map[][] is the map used and actually drawn, while mapc[][] is a copy used to overwrite map[][]. Nothing on the copy is ever changed.

Also, the player's coords are myx and myy.

I do have code that lets the player jump, but I'm having issues with it.
1
2
3
4
5
6
7
8
9
10
11
if(lock==1)
		{
			map[myx][(int)myy]=mapc[myx][(int)myy];
			myy=myy-jump;
			jump--;
			if(jump==((jumprate*-1)-1))
			{
				lock=0;
				jlock=0;
			}
		}

"jump" is simply a copy of jumprate, so if the jumprate is 5, jump is the one actually changed.

So, the main part of the jump is the jumprate variable, you may have heard of this before. It starts at, say, 5, and when the jump key is pressed, the player goes up 5. Each time, the jumprate decreases, so the player goes up 5, then 4, 3, 2, 1, 0 blocks, then starts going down, because the jumprate is still decreasing. It stops at -5, effectively creating a jump that goes up fast and slows down, then comes down slow to fast.

My problem is that the player basically jumps upwards 5 blocks, so if there are any blocks anywhere between those 5 blocks, it skips right through them.

I want something that behaves like my current jumping, but instead of adding say, 5 blocks at a time, it adds them one at a time faster and faster.

Basically, I don't want it glitching through a platform.

Thanks for the help!
Topic archived. No new replies allowed.