On Sep 18, 5:32 am, dabski <[email protected]> wrote: > Hi Mike, > > I use pyglet and pybox2d together and have never run into this type of > problem before. It sounds to me like your over complicating things by > not initializing the objects at the same time. Can you please post the > relevant code so we can better understand what you are trying to do.
Hey, For the record, Mike's situation does sound very familiar to me. Just so we're talking about the same thing, I infer his base 'model' in an MVC sense is his EntityManager. Derived from that model are other things, the physics simulation and the view, which the model shouldn't know about. So to tell the renderer to add sprites, etc, the model must raise events, which are handled by these dependant systems (which can know about the model and its events.) This sounds a lot like things I've written in the past, so from my perspective, it doesn't sound unreasonable. Of course it's not the only way of doing things. In particular, I am hazy about whether the base-level 'model' (in an MVC sense) should be the entitymanager or the physics simulation. Chipmunk provides hooks for you to associate your own objects with particular physics objects, so, for example, when a collision is detected, it is reported to your code as your own objects have collided (rather than some physics simulation objects.) This allows you to reverse the dependency of these two modules. The physics simulation becomes the ultimate arbiter of in-game state, and your controller classes act directly upon it. In turn, dependant systems like graphics and 'gameplay' react to events raised by the simulation. I don't know which makes most sense. It could be, as dabski says, that I'm over-complicating it. :-) -- 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.
