June 2015
Beginner
354 pages
8h 23m
English
We will assign the R key as the restart key for our game. Now, let's perform the following set of steps:
box2dcargame.js JavaScript file in a text editor.function removeAllBodies() {
// loop all body list to destroy them
for (var body = carGame.world.GetBodyList(); body != null; body = body.GetNext()) {
carGame.world.DestroyBody(body);
}
}restartGame. They were originally in the page loaded handler function:function restartGame() { removeAllBodies(); // create the ground createGround(250, 270, 250, 25, 0); // create ...Read now
Unlock full access