Pygame · Window and game loop
The game loop and clock
Frames that feel smooth
A game loop repeatedly: process events → update state → draw → flip. Cap FPS with pygame.time.Clock so motion is consistent across machines.
``python
clock = pygame.time.Clock()
# inside the loop:
clock.tick(60) # aim for 60 FPS
``Keep update logic separate from draw logic so you can change visuals without breaking physics.
Practice checkpoints
Quick quiz
clock.tick(60) is mainly for…