Currently the game uses approximate time per frame as a simple way to make it work at multiple frame rates.
A better practice is to use the actual time between frames, which is delta time (change in time).
I already implemented dt in the Game class, it's just not used.
I think this is what needs to be done:
- Remove APPROX_TIME_PER_FRAME and multiply constants by dt instead. For example do ship.slow_down(arg * self.dt)
- Use it everywhere in the game (ship, projectiles, asteroids)
At the moment if the game is running at a lower frame rate than it's supposed to, the change in time will be greater than the approximate predicted change in time defined in the constant APPROX_TIME_PER_FRAME. This should result in the ship going slower than it's supposed to.
Currently the game uses approximate time per frame as a simple way to make it work at multiple frame rates.
A better practice is to use the actual time between frames, which is delta time (change in time).
I already implemented dt in the Game class, it's just not used.
I think this is what needs to be done:
At the moment if the game is running at a lower frame rate than it's supposed to, the change in time will be greater than the approximate predicted change in time defined in the constant APPROX_TIME_PER_FRAME. This should result in the ship going slower than it's supposed to.