[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] I have a quick question... again...
On Wed, June 20, 2007 1:31 am, Charles Joseph Christie II wrote:
> Well, if I don't use the pygame sprite module, what should I use?
In the code over at
<http://kschnee.xepher.net/code/070530ShiningSeaSource.zip> there's one
file, "nixie.py", that might be useful. It's messy, but it's got code for
tasks like loading animation frames from a single character sheet (with
any size or padding) and the logic of animation sequences. "coral.py" is a
tile engine that changes the sprite locations based on the location of a
hypothetical camera.
Recently I tried reducing the size of the tiles I was using, and I found
that the character seemed to move more slowly. It was a pleasant surprise
to figure out that the character was covering ground at the same rate,
because the "world coordinates" of the character were unaffected by the
size of the graphics.
> Also, I'm reading about MVC from multiple sources right now and, although
> I get the concept, I'm still not 100% sure how to use it in a game.
What I've tried to do is have what I call a "worldsim," the Model in MVC,
that tracks the game's characters and environment. I test that out in
plain text. Then I build a Display class (the View), and give it access to
the Model. The Controller part of MVC might be built into the View too.
The upshot is that I've then got an object that's the Model, that's
accessed by the View/Controller. Doing that means the graphics engine can
be replaced relatively easily. It can be awkward, though, since the Model
needs some way to send messages to the main class like "the player got
killed."