In the last section of this chapter, we are going to create an interactive animation. It is a simplified version of the classic Pong Game.
Before we get on with the Pure Data patch, we first draft a brief plan about the steps we have to do.
Animate the moving ball
Bounce the ball on the four margins
Create the paddle control
Keep and display the score
We start with a ball that bounces around in the GEM window. Remember that we use the metro
object to animate graphics in the Chapter 2, Computer Graphics with the GEM Library. To make a ball move, we change its position within the GEM window by using the translateXYZ
object. Here is the first version of the patch Pong001.pd
.
Changing the two number boxes for the translateXYZ
object will move the ball around. In order to create an animation, we need to use the metro
object to automate the changing of the numbers. In Chapter 2, Computer Graphics with the GEM Library, we have used a counter
object...