I have myself a parallaxing background, i'm using SFML to render my background, I have myself 3 sf::Sprites, each sprite has the width of 576, I create myself 3 sprites with x positions 0, 576 and 1152. I then have some if statements that will move the background sprites when they go so far off the screen however... small gaps keep appearing, here is my code for my background manager
void BackgroundManager::Update(int playerXVel)
{
//Update level backgrounds
for (int i = 0; i < 3; i++)
{
sf::Vector2f postion = levelBackgroundSprites[i].getPosition();
levelBackgroundSprites[i].setPosition(postion.x += playerXVel, postion.y);
if (postion.x <= -576)
{
levelBackgroundSprites[i].setPosition(1152, postion.y);
}
else if (postion.x >= 1152)
{
levelBackgroundSprites[i].setPosition(-576, postion.y);
}
}
}
I have attached a screenshot