HTML and CSS Reference
In-Depth Information
for
for ( var
var i = 0 ; i < wallDefs . length ; i ++ ) {
var
var wallDef = new
new b2BodyDef ;
wallDef . type = b2Body . b2_staticBody ;
wallDef . position . Set ( wallDefs [ i ]. x , wallDefs [ i ]. y );
var
var newWall = world . CreateBody ( wallDef )
var
var wallFixture = new
new b2FixtureDef ;
wallFixture . density = 10.0 ;
wallFixture . friction = 0.5 ;
wallFixture . restitution = 1 ;
wallFixture . shape = new
new b2PolygonShape ;
wallFixture . shape . SetAsBox ( wallDefs [ i ]. w , wallDefs [ i ]. h );
newWall . CreateFixture ( wallFixture );
walls . push ( newWall );
}
var
var debugDraw = new
new b2DebugDraw ();
debugDraw . SetSprite ( context );
debugDraw . SetDrawScale ( 30 );
//define scale
debugDraw . SetFillAlpha ( 0.3 );
//define transparency
debugDraw . SetLineThickness ( 1.0 );
debugDraw . SetFlags ( b2DebugDraw . e_shapeBit | b2DebugDraw . e_jointBit );
world . SetDebugDraw ( debugDraw );
function
function gameLoop () {
window . setTimeout ( gameLoop , 20 );
drawScreen ()
}
gameLoop ();
}
< /script>
</head>
</head>
<body>
<body>
<div
<div style= "position: absolute; top: 0px; left: 0px;" >
<canvas
<canvas id= "canvasOne" width= "500" height= "400" >
Your browser does not support the HTML 5 Canvas.
</canvas>
</canvas>
</div>
</div>
</body>
</body>
</html>
</html>
Search WWH ::




Custom Search