PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: Karl Macklin on July 28, 2009, 12:15:05



Title: Box2D in PureMVC, does it have its place?
Post by: Karl Macklin on July 28, 2009, 12:15:05
Recently I started looking into Box2DFlash.
As you probably know, it is a physics library by Erin Catto ported to AS3.

A very useful and popular approach in Box2D is to create "Actor" classes. The constructor of an actor class takes both the mathematical physics body object, and the DisplayObjectrelated to it.

The Actor then updates its own DisplayObjectbased on the physic body object.

The DisplayObject clearly is part of the view in PureMVC terms, just like the B2D Body is part of the model. Yet they're in the same class in the Actor class approach.

Let's say you're making a flash game based on both PureMVC and Box2D. You want to take advantage of the benefits the Actor class gives you. What would be a good solution?


Title: Re: Box2D in PureMVC, does it have its place?
Post by: puremvc on July 31, 2009, 04:22:13
I'm not familiar with Box2D enough to know what context these 'Actors' are used.

What are the benefits of having a fence-riding business object that carries the display object and the object's model? What is this class's role and responsibilities? Who are its collaborators?

Does this Actor class do anything more than aggregate these two things in one place? Does it act as a controller, basically making sure the display object and its model stay in sync?

-=Cliff>


Title: Re: Box2D in PureMVC, does it have its place?
Post by: dihardja on August 24, 2009, 05:40:44
I think, a possibility integrating Box2d into puremvc is to create Box2d view components. these view components can uses the Box2d functionality internally and provide methods for their mediators for manipulating them. this way the rest of the system doesn't have to deal with the box2d lib directly, only with the view components as usual.


Title: Re: Box2D in PureMVC, does it have its place?
Post by: puremvc on August 24, 2009, 10:26:52
Sounds like a good solution.

-=Cliff>


Title: Re: Box2D in PureMVC, does it have its place?
Post by: dimumurray on February 01, 2011, 09:10:00
I know that this topic is over a year and a half old, but I'd like to revive the discussion.

So, has anyone managed to integrate box2d into a PureMVC framework?

I was thinking of making the attempt myself, but it would be nice to benefit from the experience of those who've made the attempt before.