Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Box2D in PureMVC, does it have its place?  (Read 6690 times)
Karl Macklin


Email
« 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?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
dihardja
Jr. Member
**
Posts: 17


View Profile Email
« Reply #2 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.
« Last Edit: August 24, 2009, 05:50:12 by dihardja » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: August 24, 2009, 10:26:52 »

Sounds like a good solution.

-=Cliff>
Logged
dimumurray
Newbie
*
Posts: 1


View Profile Email
« Reply #4 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.
Logged
Pages: [1]
Print