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 Scroll Speed #10

Open
greggman opened this issue Apr 5, 2022 · 0 comments
Open

Fix Scroll Speed #10

greggman opened this issue Apr 5, 2022 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@greggman
Copy link
Owner

greggman commented Apr 5, 2022

Because game runs at 10fps and scroll speed is set to 10% that means for each of the 6 displayed frames of a game frame the screen scrolls at 6 different rates.

In other words, lets say the screen needs to scroll 32 pixels (one tile)

It might scroll 32 * 0.1 pixels on frame 1 or 3.2px to position 3.2
Then it would scroll 28.8 * 0.1 pixels on frame 2 to 6.08
Then it would scroll 25.92 * 0.1 pixels on frame 3 to 8.672
As you can see each frame is slower but then jumps up when the player moves further
At frame 6 a game frame ticks and now it's target is 64 pixels.

This stutter is noticeable.

A simple solution is probably just a max velocity of tilesSize / frameRate

@greggman greggman added bug Something isn't working enhancement New feature or request labels Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant