I have a basic snake game movement system with Pygame:
clock = pygame.time.Clock()
if timer == MOVE_TICK_INTERVAL:
timer = 0
move_snake()
timer += 1
clock.tick(MAX_FPS)
The issue is that the higher MAX_FPS
is, the faster timer
iterates and thus the faster the snake moves. I'm aware of using some form of delta_time
variable to calibrate and adjust the velocity of an object moving continuously but I don't know how to implement this method with discrete, grid-based movement.
In short, I want to move my snake the same amount of units in a direction every interval with frame rate considered but I don't want to modify said distance.