Skip to content

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

@yak1r

Description

@yak1r

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions