In the previous chapter, we talked about how to integrate the physics engine into your code. We also started implementing physical bodies to the brick objects, and now, we'll need to do the same with other active game objects, such as the paddle and ball. Let's continue with this last half of the tutorial. We will continue using our main.lua
file from the Breakout
project folder.
Corona display objects can be turned into simulated physical objects using one line of code. The following information explains the different forms of physics bodies:
If no shape information is specified, the display object takes on the form of the actual rectangular boundary of the original image to create the physics body. For example, if a display object is 100 x 100 pixels, then this would be the actual size of the physics body.
If a shape is specified, then the body boundaries will follow the polygon provided by the shape. The shape coordinates must be defined in a...