June 2015
Beginner
354 pages
8h 23m
English
We will make the world time advance by carrying out the following steps:
step function in the world instance periodically. We used setTimeout to keep calling the step function. Put the following function in our JavaScript logic file:function updateWorld() {
// Move the physics world 1 step forward.
carGame.world.Step(1/60, 10, 10);
// display the build-in debug drawing.
if (shouldDrawDebug) {
carGame.world.DrawDebugData();
}
}initGame method:setInterval(updateWorld, 1/60);
Read now
Unlock full access