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

Re: [pygame] Scrolling





Yanom Mobis wrote:
How is scrolling tipicallly done in pygame? I was thinking of creating a large surface, blitting all the game objects to that surface, and then blitting part of that surface to the screen. like this:


That's kinda what I do.
I blit part of the background directly to the screen and then blit all game objects to the screen. There's no real need for a large intermediary surface. Unless you want to do something like scaling/rotation on the whole thing.

Unfortunately it is slow as hell.
Depending on the nature of game you could attempt some form of dirty rectangles to reduce the amount of blitting going on, but it's usually not worth it if there's a lot of scrolling going on.