Game Development Reference
Defining the Bumper and Ball
The ball and bumper images are both circles, so you can use the Add Circle command
from the toolbar to create a circle shape. The circle shape has only one “vertex” that
acts as a handle to resize the circle shape.
Starting with the bumper, change the circle shape's size and position so that it overlaps
the solid part of the bumper while ignoring the bumper's shadow. Set the bumper's an-
chor point to Pixel coordinates 33, 42 so that the anchor point is centered on the bump-
er. Set the collision bits category check box next to Bumper , and set the Mask check
box of the Ball row.
To simulate the bumper's bounce effect, modify the Fixture parameter in the Paramet-
ers pane labeled Restitution. Restitution is the amount of elasticity with which an ob-
ject repels other colliding objects. A restitution of 0 means that the collision is not
elastic at all and will stop the incoming object. A restitution of 1 simulates a perfect
elastic collision, allowing the colliding object to continue at the same speed after col-
Because in this case you want to simulate an additional repelling force coming from
the bumper, you can use a value of 1,5 or higher to have the colliding object move
away from the collision at a higher speed than it had when it impacted.
Lastly, create the circle shape for the ball image. Size and position the circle shape so
that it overlays the entire ball image. Set the anchor point Relative values to 0,5 and
As for the ball's collision bits, set the category check box next to Ball and check all
the Mask check boxes for the other categories: Ball , Bumper , Flipper , Plunger ,
and Wall . You can also simply click the All button at the bottom of the Mask column.
Because you don't use the other bits, it doesn't matter if they are checked, too.
Some of the ball's Fixture Parameters affect how the ball behaves on the table. I set the
Density to 8,0, Restitution to 0,3 and Friction to 0,7. These settings give the ball just a
little bit of bounce. Feel free to tweak these settings and observe how the ball's behavi-
Save and Publish