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

Player can't jump over columns in higher FPS settings #5

Open
yak1r opened this issue Oct 27, 2023 · 0 comments
Open

Player can't jump over columns in higher FPS settings #5

yak1r opened this issue Oct 27, 2023 · 0 comments

Comments

@yak1r
Copy link

yak1r commented Oct 27, 2023

Hello,

This is a recurring issue, as already discussed within fifty-bird: games50/fifty-bird#2
As I explained there, the physics of the gravity calculation is wrong, and causes the gravity to be "too strong" for machines that run with FPS higher than 60

In this repo the mistake happens here

self.player.dy = self.player.dy + self.gravity
self.player.y = self.player.y + (self.player.dy * dt)

when adding the gravity to the player's dy it is not multiplied by dt, and the dy is decreased by gravity every frame, when the frame rate is higher, the gravity is stronger and at my machine (144 fps) the player simply can't jump over columns

as with fifty-bird, I prefer to suggest a solution and not just complain, see my Pull Request: #4

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

No branches or pull requests

1 participant