How make my player jump

Basically i'm makign a game for a uni assignment, however i can't work out how to get the player to jump (Making a platformer), unfortunatley trying to explain it is gonna be tricky, so what i'm going to do is show the code i would use to make my character move left / right

[Class].setXpos([Class].getXpos() + 1); // Allows player to move right

setXPos = setting the position along the X axis
getXPos = retrieve that data from the cpp of the class

not sure how to make the player jump, i'm thinking just doing the same thing with Y pos, but that wouldn't have any gravity in it

Anyone got any ideas?
I'm not an expert of this kind of situation but I think something like this
[Class].setYpos([Class].getYpos() -10 );
to jump to the top of 10 position...
and then you can add the gravity effect that might add +1 to the position every 50 milliseconds... other use other times but I think this is a solution that might work
that is what i was thinking, i should add the fact that i'm using SFML so co-ordinates are a little different than regular orientation
Topic archived. No new replies allowed.