[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Scrolling Background



Neil Broers wrote:
> 1 > Possible with Pygame
> 2 > If it is, how to actually get the background to scroll
> 3 > If Pygame would achieve a high enough FPS rate

scrolling is possible in pygame. it works as you probably expect.
each frame you render the entire background, then draw all the sprites.

i wouldn't use a resolution higher than 640x480, and you might consider 
making part of the screen some sort of interface that doesn't scroll.

if using straight pygame/SDL, your game will run around 30 fps on an 
average machine. this isn't a limitation of python at all, it's just how 
fast SDL can push pixels around in software mode.

the other option would be to design your game to run in SDL's hardware 
mode. this would use things like DGA on linux, or DIRECTX on windows. once 
you are in a hardware accelerated pygame display, your game will probably 
run at 100 fps with fairly conservative hardware. on some machines you will 
see much higher speeds.

a couple things to keep in mind. for a lot of games, 30fps is fine. 
creating your game to run in software ends up being a lot more flexible and 
forgiving. if you want the speed of hardware, go for it. but i recommend 
using an all-or-nothing approach. supporting both hardware and software 
modes requires almost building 2 games. things you do to make software mode 
quicker end up really slowing down the hardware stuff.

as far as examples go, i keep hearing of people working on scrolling games, 
i'm guessing it won't be too long before something starts to arrive.

good luck!

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org