I commonly run into this scenario, and I'm wondering what the "best"
pattern is for handling it:

On my game client, I have collections of things.  Often these things
need to access all the other things (for collision detection, mostly).
 So I have a list of "other players", a list of rockets, a list of
"lines" which you can walk on, etc.  Sometimes I make these lists
global with "global whateverlist" wherever I use it.  Sometimes I
attach them to my window (I subclassed the window object, and the main
loop is in my subclassed window's run() method) and they reference
each other through self if both collections are attached to the
window.  Sometimes I make the window itself a global var and access
lists attached to the window from lists outside the window that way.
Sometimes I pass the members of one collection as arguments to the
methods of the members of a different collection.  And I'm sure I do
even stranger things than that, but that end up working.

So, what's the "best" way to organize these kinds of things where the
members of one collection often need to iterate through the members of
other closely related collections?  And I define best as "a reasonable
balance of elegance (understandability) and performance".

~ Nathan

--~--~---------~--~----~------------~-------~--~----~
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