[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] how to bind surface rects without subsurface (need help with bug)

I have been working on a game for a while, and ran into a problem. I am
drawing layers with a background, player, and foreground layer. The
forground is transparent and redraws treetops and stuff the user should
always be in front of. That works great, however I cannot find any
logic in my code as to why The foreground layer is slightly offset by 3
or 4 pixels when the map is scrolling (the map scrolls when the player
is within range of the screen's edge).

I realize my code isn't the best code there is, but it's also my first
programming project and I've been teaching myself all sorts of things
as I go. But, could someone please take a look at code and
tell me why the foreground isn't aligned when scrolling? To reproduce,
you'll have to move the player toward the right side of the screen
until it scrolls the map, and while it does pay attention to the huge
trees and other foreground objects such as the tall grass.

You can grab the source at

Thanks for all the help,
Michael Fiano