Game Development Reference
In-Depth Information
Adding Bodies to the World
Bodies are what make Box2D games possible. Anything you can move or interact
with, is a body . Birds, pigs, and crates in Angry Birds are bodies, as well as the idol
and the totem bricks in Totem Destroyer.
During this chapter, you will learn to create every kind of Box2D body, in addition
to some other important features, including:
• Creating circular bodies
• Creating rectangular bodies
• Creating any kind of polygon
• Using debug draw to test your simulation
• Defining body types: static, dynamic, or kinematic
• Setting material attributes: density, friction, and restitution
• Units of measurement
• Creating compound objects
By the end of the chapter, you will have your first Totem Destroyer level ready to
play with. This will be a long chapter, so let's drive straight to the point.
Your first simulation - a ball falling on
the floor.
We are starting with an easy task, the simplest of all physics simulations: a ball
falling on the floor. Anyway, although it's just another falling ball, being your
first simulation this will be quite an achievement.
Search WWH ::




Custom Search