Our first task is to create a simulated physics world and put two objects inside it.
In the index.html
file, the core part is the game
section. We have two canvas
elements in this game. The debug-canvas
element is for the Box2D engine and canvas
is for the CreateJS library:
<section id="game" class="row"> <canvas id="debug-canvas" width="480" height="360"></canvas> <canvas id="canvas" width="480" height="360"></canvas> </section>
We prepare a dedicated file for all the physics-related logic. We prepare the physics.js
file with the following code:
;(function(game, cjs, b2d){ // code here later }).call(this, game, createjs, Box2D);