• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 16. Pinball > Points to Remember

Points to Remember

  • Understanding collision detection (specifically wall, ball-line, and ball-ball collisions) is imperative to understanding this game.

  • While the goal of the game is to get the highest score possible, in a full game of pinball the object is to send the ball into various locations on the table in a certain order.

  • Using the createLine() function, we draw lines in memory with which the ball can react.

  • At the interface between two lines, such as the vertices of the triangles, there are odd edge effects, which cause undesirable and unexpected behaviors in the ball's motion. We have used certain tricks in this game to compensate for these odd behaviors. For example, we use invisible movie clips over visible graphic elements to help us deflect these edge-effect problems.

  • As in the 9-ball game, we don't execute the patch() function every frame, but rather once every 20 or 30 frames, to check on the edge-effect problem mentioned directly above.

  • The critical buildMap() function places all of the objects and defines the walls in memory.

  • The fairly straightforward createLine() function has been modified to include the ability to play a sound when the ball hits a line.

  • Disabling objects that are clearly not needed at certain times—for instance, collision detection on the launch bank when the game ball is already in play on the table—is a good way to speed up and streamline the game.

  • You can use small and/or invisible bumpers to limit the ball's movements (around objects it shouldn't enter, for example), using the addBumper() function.

  • The limited-use function hitTest() can be used to determine a collision between the ball and the flipper. We have used a wedge-shaped movie clip with hitTest() to determine these collisions.

  • There are a lot of improvements—some simple, some not—you could make to this game!



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint