On Thu, Mar 6, 2008 at 10:49 PM, Nathan <[EMAIL PROTECTED]> wrote: > > On Thu, Mar 6, 2008 at 8:42 PM, Casey Duncan <[EMAIL PROTECTED]> wrote: > > If you have a bunch of things and one or more actions to perform on them, > > you should put all of them into a collection object with methods that do > > what you want to the collection. So rather than have each object test > > collision with every other (a simple, but rather inefficient algorithm), > you > > would ask the "collision space" object containing all of the objects, which > > objects collide. If objects collide, then the collision space could call a > > method on each colliding object saying what it collided with. Or the > > collision space itself could handle the collisions, though I prefer the > > former method since you let each object decide it's behavior. For example, > a > > missile object might hit another object. When the missile's "collide(self, > > other)" method is called, it would explode and call the damage() method on > > the other object (or something like that). > > > > This encapsulates your collision handling (or whatever you do at the > > collection level) in one place so that the node object just need to know > > what to do when they collide, not how to figure out who they collide with. > > It also gives you an easier way to plug in a more efficient algorithm or a > > different implementation altogether (e.g, using ode) > > Ooo, I like that idea! But what's "ode"? > > ~ Nathan >
http://www.ode.org/ -- \\\\\/\"/\\\\\\\\\\\ \\\\/ // //\/\\\\\\\ \\\/ \\// /\ \/\\\\ \\/ /\/ / /\/ /\ \\\ \/ / /\/ /\ /\\\ \\ / /\\\ /\\\ \\\\\/\ \/\\\\\/\\\\\/\\\\\\ d.p.s --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
