diff --git a/Chapter02/BGSpriteComponent.cpp b/Chapter02/BGSpriteComponent.cpp index 4c143704..c438e131 100644 --- a/Chapter02/BGSpriteComponent.cpp +++ b/Chapter02/BGSpriteComponent.cpp @@ -26,7 +26,7 @@ void BGSpriteComponent::Update(float deltaTime) // the right of the last bg texture if (bg.mOffset.x < -mScreenSize.x) { - bg.mOffset.x = (mBGTextures.size() - 1) * mScreenSize.x - 1; + bg.mOffset.x += mScreenSize.x * mBGTextures.size(); } } }