Carry out the following steps:
1. Again, we start from our game logic. Open the
html5games.box2dcargame.js
JavaScript file in a text editor.2. We setup a destination ground in the ground creation code and assign it to our
gamewinWall
reference inside thecarGame
global object instance as follows:carGame.gamewinWall = createGround(1200, 215, 15, 25, 0);
3. Next, we move on to the
step
function. In each step, we get the complete contact list from the world and check whether any two colliding objects are car and the destination ground:function step() { carGame.world.Step(1.0/60, 1); ctx.clearRect(0, 0, canvasWidth, canvasHeight); drawWorld(carGame.world, ctx); setTimeout(step, 10); //loop all contact list to check if the car hits the winning wall for (var cn = carGame.world.GetContactList(); cn != null; cn = cn.GetNext()) { var body1 = cn.GetShape1().GetBody(); var body2 = cn.GetShape2().GetBody(); if ((body1 == carGame...