Quick answer: Keep game logic in floats and convert at the boundary: int() or round() coordinates exactly where they enter drawing calls, or use Rects (which are integer) as the render-side representation.
Movement math should be float; pixels are integers. This error is the boundary between them handled sloppily. Here is the clean split.
How to fix it
1. Convert at the draw call
screen.blit(img, (int(x), int(y))) or pygame.draw.circle(screen, c, (round(x), round(y)), r) — conversion belongs at the API boundary, not scattered through physics.
2. Store logic floats, render ints
Keep self.x/self.y (or a Vector2) as floats for smooth dt-based movement, and update an integer self.rect.topleft = (round(self.x), round(self.y)) once per frame for drawing and collision.
3. Mind division and dt
Integer positions silently become floats after / or * dt — Python floats infect everything downstream, so the boundary conversion must be unconditional.
4. Prefer round() for smoothness
Truncation (int()) biases movement toward the origin and can look jittery at slow speeds; rounding tracks the true position more faithfully.
Catching the ones you can't reproduce
The hardest version of this to fix is the one you can't reproduce — it only happens on a player's hardware, OS, driver, or save state, under conditions that simply aren't present on your machine. A report that says “it crashed” or “it froze” gives you nothing to act on, so the bug survives release after release while quietly costing you players.
Automatic error capture closes that gap. Each failure arrives with its full stack trace, the device and OS, the build number, and a breadcrumb trail of what the player did right before it broke, so even a failure you have never seen becomes a specific, reproducible issue. Fold identical failures into one signature ranked by how many players each hits, and your worklist sorts itself worst-first instead of arriving as a stream of vague complaints.
This is where a tool like Bugnet earns its place. Its SDK captures every Pygame error automatically with the full stack trace plus device, OS, memory, build, and game-state context, folds duplicates into one grouped issue with an occurrence count, and ties each to the build it first appeared on — so you fix the problem that hurts the most players first and confirm it is gone when its signature disappears from the next release.
The errors you never hear about are the ones quietly costing you players. Visibility turns them into a worklist.