Game Development Reference
In-Depth Information
What just happened?
We added our main loop. This will update the Box2D simulation and then it's up to us to
take care of positioning our sprites based on the resulting information.
Note
One very important aspect of Box2D is understanding what can be changed inside a
b2World::Step call and what can't.
For instance, a body cannot be made inactive ( b2Body::SetActive ) or be destroyed
( b2World::DestroyBody ) inside a step. You will need to check on conditions outside
the step to make these changes. For instance, in our game, we check to see if the ball
sprites are visible or not, and if not then we set their bodies as inactive. And all this is done
after the call to b2World::Step .
Search WWH ::




Custom Search