hello i am creating a platformer in C++/SDL and for some reason i cant work out the input for the jumping when i press the "UP" key like so
case SDLK_UP: jumping = true; break;
which sets jumping to true
inside the main game loop i have this
if (jumping == true)
{
myDot.yVel = 0;
myDot.yVel -= 30;
if (myDot.yVel == -100)
{
myDot.yVel = 0;
myDot.yVel += 60;
jumping = false;
}
}
what this is little snippet is supposed to repersent is when you press the "UP" button jumping is set to true which them runs this which sets yVel to = and then decreases it by 30 (which allows the player to move in the upwards direction for by 30. However when it hits -100 it knows you have jumped high and starts decreasing your yVel to fall back to the ground. But what is actully happening is the Player(myDot) is just forever going in the upwards position even though i have set it to stop at -100.
i realize i have completely over complicated that but you get the picture

Find content
Not Telling