Movement in games is usually approached as constantly changing states, rather than functions. Programming requires a different approach to math than teached in school because it often requires iterative approaches.
Character::Update()
{
[...]
onGround = [... has the character ground under his feets? ...];
dt = [... time difference between now and the last time this function was called ...];
if(keydown(SPACE) && onGround)
{
yDir = 40; // Can be anything depending on how high you want the jump to be.
onGround = false;
}
if(!onGround)
{
yDir-=gravity*dt;
y+=yDir*dt;
if([... collision with the landscape occured...])
{
y=[... y-coordinate of the ground];
yDir=0;
}
}
[...]
}
Basically you have two components per coordinate, the position and the velocity. Now every frame the gravity is applied to the y-velocity and checked for collision, in which case the y-velocity is zeroed (= not moving in y direction). Moving left and right is done the same way, just that it isn't affected by gravity.
if(onGround) // You can only walk with feet on the ground
{
xDir=0;
if(keydown(LEFT))
{
xDir = -40; // How far should he move?
}
else if(keydown(RIGHT))
{
xDir = 40;
}
}
x+=xDir*dt;
if([... collision with the landscape occured...])
{
x=[... x-coordinate of the wall];
xDir=0;
}
General Animation Appendix
Animations are usually hand crafted by artists. In 3D usually bones are used for this, in 2D the animations are usually baked into a spritesheet, in which case it doesn't matter for the engine how they are created. Modern engines often include Inverse Kinematics (IK) for more dynamic motions. Sometimes 2D engines use bones too for the sake of IK.
Other than that there aren't really any "basic concepts" how animations are done, in the end whether a animation looks good or not depends on you fine tuning the parameters. There is no all-in-one solution, everything requires some artistic input.