[pygame] Scrolling background

2011-07-30 Thread Samuel Mankins

Hello!
Forgive me if this is a trivial question.
What is the nicest way to go about having a background which moves at a 
constant speed in one direction (as in a side-scrolling shooter)? Right 
now, I draw all the sprites onto the background image, which is moving, 
and then draw that onto the screen, but is there a neater way?

Thank you!


Re: [pygame] Scrolling background

2011-07-30 Thread NBarnes
Samuel Mankins waterfli...@speakeasy.net wrote:


 Forgive me if this is a trivial question.
 What is the nicest way to go about having a background which moves at a
 constant speed in one direction (as in a side-scrolling shooter)? Right now,
 I draw all the sprites onto the background image, which is moving, and then
 draw that onto the screen, but is there a neater way?

You have a background that you want to scroll, so it's bigger than the
screen, right?  However it pleases you to do so, determine which
subsection of the background you want to display that frame, then draw
that onto the screen, then draw the sprites on top of that.


Re: [pygame] Scrolling background

2011-07-30 Thread Samuel Mankins

All right, that's pretty much what I'm doing. Thank you!

On 7/30/11 12:56 PM, NBarnes wrote:

Samuel Mankinswaterfli...@speakeasy.net  wrote:



Forgive me if this is a trivial question.
What is the nicest way to go about having a background which moves at a
constant speed in one direction (as in a side-scrolling shooter)? Right now,
I draw all the sprites onto the background image, which is moving, and then
draw that onto the screen, but is there a neater way?

You have a background that you want to scroll, so it's bigger than the
screen, right?  However it pleases you to do so, determine which
subsection of the background you want to display that frame, then draw
that onto the screen, then draw the sprites on top of that.






[pygame] Scrolling Background module

2007-12-31 Thread sjbrown
Hi all.

Here's a module that provides a scrolling background.  This is pretty common
in 2D games and I think it should be considered for inclusion in pygame.

To see a simple, 100-line example, just run:

python scroll_example.py

-sjbrown

scrolling.tar.gz
Description: GNU Zip compressed data