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

Re: [pygame] Standard methodology for different game screens





On Sat, Sep 19, 2009 at 3:13 PM, Pablo Moleri <pmoleri@xxxxxxxxx> wrote:
Hello,

I'm going through a game code written in pygame, the game shows different screens:
- an introduction
- a menu
- and then it enters to different game modes.

For each of these parts there's a different pygame loop, which doesn't seem right.
I would like to know if there's a standard way to use pygame in this scenario.

Thanks in advance,
Pablo


I see no problem with that:
each screen/scene has it own update style.
intro -> stepped script
menu ->  gui events handling
gamescreen -> world simulation dt updating, IO feed player actor

By keeping separate what is different, the code is more clear.
Anyway, in my code usually I group the code related to a screen/scene in an appropriate class, by example 

class LevelPlay(object):
    def __ init__(self,..):
    def start(self):
    def update(self,dt):
    def draw(self)
    ...

--
claxo