I'm using setspriteX to scroll the background with the viewpoint. I have my character scrolling but not the background. The code seems like it should be simple but the backgrounds not moving. I can attach the project if needed
Creating the background sprite
void app::Begin( void )
{
//set variable for moving screen
moveScreen = 0.30f;
//load & create sprite & set variables for background
streetImage = agk::LoadImage("images/nomoon.png");
bgSprite = agk::CreateSprite(streetImage);
agk::SetSpriteSize(bgSprite,-1, 100.f);
agk::SetSpriteVisible(bgSprite,1);
//agk::FixSpriteToScreen(bgSprite,1);
agk::SetSpritePosition(bgSprite,fx, 0);
//agk::SetSpritePhysicsOn(bgSprite,2);
agk::SetSpriteDepth(bgSprite, 10);
//my attempt to wrap/loop image
agk::SetSpriteUVScale(bgSprite,1,1);
agk::SetImageWrapU(streetImage,1);
agk::SetImageWrapV(streetImage,1);
imageWidth = agk::GetImageWidth(streetImage);
}
game loop scrolling sprites
void app::Loop ( void )
{
agk::SetViewOffset(fx, fy);
agk::SetSpriteX(cynSprite, 20 + fx);
agk::SetSpriteX(bgSprite, 20 + fx);
//agk::SetSpriteY(cynSprite, agk::GetSpriteY(cynSprite) + gravity);
fx += moveScreen;
//agk::SetSpritePosition(bgSprite,fx, fy);
//agk::SetSpritePosition(bgSprite, agk::GetSpriteX(bgSprite) + 1, agk::GetSpriteY(bgSprite) );
skySpeed += 1.1f;
agk::SetSpriteUVOffset(bgSprite, skySpeed/imageWidth, 0.0);
agk::Sync();
}