Going subpixel with pygame
first of all, sorry to not have posted any diary entries during the pyweek itself.
This pyweek we had slow moving objects and using pygame that only knows integer coordinates for pixels resulted in a jittery movement. The reason is simple: while the position was calculated in a float that had to be rounded in some way to an integer pixel coordinate. So if the position only changed slowly this results in objects just hopping one pixel from now and then.
Then I remembered a post from long ago: Going subpixel with pygame
The downside of this is that it requires numpy. But then I remembered that I made a version that uses pygame only (with some clever surface scaling, can be found here: SubPixelSurfacePygame ). This is what we used in our entry so the slow moving objects slide smoothly and do not hop from one pixel to another.
The downside of this sub pixel approach is 9 times more memory usage and slightly blurry images. But it still looks a lot better than without.
(log in to comment)