June 2015
Beginner
354 pages
8h 23m
English
Carry out the following steps to create our first dynamic body:
createGround function:// temporary function
function createBox() {
var bodyDef = new b2BodyDef;
var fixDef = new b2FixtureDef;
bodyDef.type = b2Body.b2_dynamicBody;
bodyDef.position.x = 50/pxPerMeter;
bodyDef.position.y = 210/pxPerMeter;
fixDef.shape = new b2PolygonShape();
fixDef.shape.SetAsBox(20/pxPerMeter, 20/pxPerMeter);
var body = carGame.world.CreateBody(bodyDef);
body.CreateFixture(fixDef);
return body;
}createBox function. Place the following code after we call the ...Read now
Unlock full access