Simple Jumping Physics

So I’ve only made top-down games in the past, and I wanted to try a platformer. Unfortunately, I’m having trouble with jumping.
I don’t want to use an external physics library like JBox2D for my first platformer, just to get some experience in making simple 2D physics on my own. All I need is gravity that sucks the player down until they collide with a platform, and then being able to jump from that platform on to other platforms. Simple right? Well apparently it isn’t for me…

My game is tile based by the way. I need a way of checking if the player is “on the ground” before he/she can jump. For a tile based game, how would this work? I also need a way to actually “jump” if the player is indeed grounded.

The pseudocode would be like this:


if(!player.isGrounded()){
    applyGravity();
}else{
    if(jumpButtonPressed()){
        jump();
    }
}

So to conclude, I need to know how to check if the player is “on the ground” in a tile based game, and I need to know how to make the player jump if they are.