Game Development Reference
In-Depth Information
stage.removeEventListener(MouseEvent.MOUSE_UP,
killJoint);
}
Now you can pick another body. Too bad there's only one dynamic body in
this world, but we are going to add a lot of stuff in a matter of seconds.
16. Just one last thing, if you want debug draw to display joints, you need to
add them to the SetFlags method in the debugDraw function:
private function debugDraw():void {
var debugDraw:b2DebugDraw=new b2DebugDraw();
var debugSprite:Sprite=new Sprite();
addChild(debugSprite);
debugDraw.SetSprite(debugSprite);
debugDraw.SetDrawScale(worldScale);
debugDraw.SetFlags
(b2DebugDraw.e_shapeBit|b2DebugDraw.e_jointBit);
debugDraw.SetFillAlpha(0.5);
world.SetDebugDraw(debugDraw);
}
17. Test the movie, pick-and-drag the dynamic box. The joint is represented by
debug draw with a cyan line, and the arrow represents mouse movement:
Now that you are able to drag-and-drop bodies, let's create a new box and learn
another type of joint.
 
Search WWH ::




Custom Search