Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in Chapter2/BGSpriteComponent.cpp #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HarIgo23
Copy link

@HarIgo23 HarIgo23 commented Mar 9, 2024

I found a bug in Update BGSpriteComponent.cpp and suggest fix of its. The bug:

bg.mOffset.x = (mBGTextures.size() - 1) * mScreenSize.x - 1;

If mScrollSpeed will high, for example 600, it makes gap between two background. Cause -1 at the end of the formula is hack that makes sense only when mScrollSpeed is low.
image

My fix keeps diff between bg.mOffset.x and width, if it more than 1px.

bg.mOffset.x += mScreenSize.x * mBGTextures.size();

@HarIgo23 HarIgo23 changed the title Fix two bugs in Chapter2/BGSpriteComponent.cpp Fix bug in Chapter2/BGSpriteComponent.cpp Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant