On Jul 15, 2:57 am, Greg Ewing <[email protected]> wrote:
> greenmoss wrote:
> > the
> > most logical way to handle game and graphics data for an in-game
> > object would IMHO be to attach it to a single python object. This in
> > turn leads to manual getstate/setstate overrides, extra code, etc.
>
> > Is there some other way that people handle this type of situation?
>
> The way I tend to handle this kind of thing is that
> the game object doesn't contain a direct reference to
> the graphics data. Instead it contains some piece of
> identifying data, such as an integer or string, and
> a global dict is used to map this to the associated
> graphics data.
>
> If you like, you can hide this lookup behind a property,
> so that the object appears to have the graphics data
> as an attribute.
>
> --
> Greg

A nice side effect if this sort of change is that your game state and
your controller classes become completely decoupled from your
renderer.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to