-
I don't have my code in front of me but if I remember correctly it consists of applying a display object to each shapes .userData property at creation.
Then during your timestep, run something like
for (var b:b2Body = myWorld.GetBodyList(); b; b = b.GetNext())
{
myDisplayObject = b.userData;
myDisplayObject.x = b.x;
}
I'm probably wrong about the property names but that's the general idea.
-
This is...interesting and really simplified...
hey, can you make a movieclip part of a b2body's userdata? or does it HAVE to be a class file becasue thats honestly what this whole forum is about...
-
I don't see the point of making anything that doesn't extend DisplayObject part of user data since the whole point is visualization. If you class extended movieclip then yeah it would work.
The whole idea of writing a class at runtime doesn't really make good OOP sense unless there is a completely uncharted reason for doing so.
-
-
Assigning a movieclip as the userdata is what we've been trying to tell you to do. It may be technically possible to assign a class, but it is not what you want to do. You should bone up on the difference between a class and an instance, because it will bite you in the add until you understand it.