“Pong”

advertisement
“Pong”
Step 1: Create the “Play” button
\
then
Step 4: Make the player paddles
Paint a new sprite
To look like this…
then
And name it “Me”.
• “Duplicate” it and name the new sprite “CPU”
• Add this to “Me”
Step 2: Add the Ball
• And add the same script to “CPU” BUT enter
“165” instead of “-165” for x.
Step 5: Make “Me” follow your mouse
• Name your sprite “Ball” and add this script:
Step 3: Make the ball move
Step 6: Make “CPU” play by itself
Step 7: Make the ball “bounce” off
the paddles
Step 9: Create the score board
• Create 2 variables:
• “My Score”
• “CPU Score”
• Arrange them in each corner of the screen
Step 10: Score points!
Step 8: Add the goals
• Paint a sprite that looks like this:
And name it “Goal”
Step 11: Decorate the screen
• Edit the stage backdrop to look
like this
Tip: Hold your “Shift” key while drawing center
the line to make it super straight!
• Add this script to the stage
Additional Challenges:
1. Each time the ball hits a paddle, increase the
ball’s speed (HINT: the “steps” the ball takes will
be stored in a new variable)
2. Play a drum beat each time the ball hits a the
side or a paddle. (HINT: try creating a sprite that
borders the edge of the screen. The ball will
“touch” it when it bounces.)
3. Allow the player to select “Easy” or“Difficult”
levels. In the “Difficult” level, the “CPU” sprite
moves faster, blocking more goals. Increase the
ball speed as well. (HINT: this will be easier if
you attempt the 1st challenge above)
4. Make a “winning score” of 5 (first player with a
score of 5 wins). Create either a “Game Over”
stage background OR 2 backgrounds “You win”
or “Better luck next time!”. Stop each moving
sprite and show the correct background when
someone wins. (HINT: this will be easier if you
attempt the 4th challenge above)
To use Scratch:
Visit http://scratch.mit.edu
• Click
, then the “Play” button to see your
FINISHED GAME!
Download