Ok thanks for the reply guys.. the side scrolling problem has been solved...
But I have run into another logical problem :
I am trying to make the character jump when the space key is pressed but the jumping motion turned out very fast.
Here is the jump snippet:
int velocity =0;
int gravity = 0;
bool jumping = false;
// Rest of the code is here
if(App.GetInput().IsKeyDown(sf::Key::Space) && jumping == false)
{
velocity = -50;
gravity = 2;
jumping = true;
}
if(jumping)
{
velocity = velocity + gravity;
sprite1.SetPosition(sprite1.GetPosition().x, sprite1.GetPosition().y+(velocity));
if (sprite1.GetPosition().y == groundlevel)
{
jumping = false;
velocity = 0;
gravity = 0;
}
}