Sie sind auf Seite 1von 16

Step-by-Step Instruction to Making Basic Pong Using Scratch

1. Go to Scratch.it and click Create

2. Get rid of the Scratch Cat (Sprite) by right-clicking on it, and then click delete.
3. Create a new sprite by choosing a sprite from the library.

4. Select the Ball sprite from the Sprite Library. Click Things within the Category section and select the
yellow Ball.
5. Select a background by choosing a background from the library. Pick out any background that you like.
6. Click on the Backdrop tab, and using the rectangle tool, create a thick bar going across the bottom of the
background. Choose a color that is not used or seen in the background. It should look like the image
below.

7. Draw out a sprite by selecting the paint brush icon next to the New sprite section.
8. Using the rectangle tool, create a small horizontal bar to be the paddle for the game. You can adjust the
size and color as needed.
9. Time to start programming! Click on Scripts to get started. It should look like the image below, with
block-based programming commands and a block palette, the big square grey area to the right, where the
blocks go to program the sprite.

10. On the categories beneath the Script tab, select Events to click-and-drag a block that says When [green
flag] Clicked onto the block palette, twice. It should look like the image below.
11. On the categories beneath the Script tab, select Events to click-and-drag a block that says go to x: __ y:
__ onto the block palette. Set x to 17, and y to -63. Place the Motion block beneath one of the Event
block. It should look like the image below.
12. On the categories beneath the Script tab, select Sensing to click-and-drag a block that says mouse x
onto the block palette. Go back to the Motion section, click-and-drag a block that says set x to __ onto
the block palette. Place the Sensing block within the Motion block, within the __. This allows the bar
sprite to be controlled by the mouse. It should look like the image below.
13. On the categories beneath the Script tab, select Control to click-and-drag a block that says forever
onto the block palette. Place the Motion block beneath the Event block that has not been touched. Place
the set x to mouse x block that was recently created within the forever block. Doing This allows the
mouse to forever be in control rather than in one instance. This is the final step in programming the bar
shaped sprite. It should look like the image below.
14. Now that the bar shaped sprite is fully programmed, now it is time to start programming the Ball sprite.
Click on the Ball, the one between the Stage and Sprite 1 icons. On the categories beneath the Script tab,
select Events to click-and-drag a block that says When [green flag] Clicked onto the block palette
three times. It should look like the image below.
15. On the categories beneath the Script tab, select Control to click-and-drag a block that says forever
onto the block palette. Place the Motion block beneath any Event block. Then click-and-drag a block
that says if __ then onto the block palette, twice. It should look like the image below.
16. On the categories beneath the Script tab, select Sensing to click-and-drag blocks that say touching
__? and touching color __? onto the block palette. Place each Sensing block within the __ of the if
__ then block. Set the first Sensing block to Sprite 1, and set the other sensing block assigned to the
color of the bar edited in the stage on step number 6 by clicking the bar. By assigning this feature, the
ball will follow the outcome when either touching the Ball sprite or the color set in the block. It should
look like the image below.

17. On the categories beneath the Script tab, select Sensing to click-and-drag blocks that say play sound
pop onto the block palette. Feel free to personalize the sound. Place that Sensing block within the if
touching Sprite 1 then block. It should look like the image below.
18. On the categories beneath the Script tab, select Motion to click-and-drag blocks that say turn
[clockwise] 15 degrees and move 10 stops onto the block palette. Change 15 degrees into 180
degrees. You can adjust the number of steps, the higher the number the faster the ball. Stack the 180
degree block on top of the other Motion block, and then place the stack under the play sound pop. It
should look like the image below.
19. On the categories beneath the Script tab, select Control to click-and-drag blocks that say wait 1 secs
and stop all onto the block palette. Change the secs to .5 and stack it under the Motion blocks within
the if touching Sprite 1 then block. Place the other Control block within the if touching color then
block. Stack the two together and place them within the forever block. It should look like the image
below. This is one programming done.

20. On the categories beneath the Script tab, select Control to click-and-drag a block that says forever
onto the block palette.
21. On the categories beneath the Script tab, select Motion to click-and-drag a block that says point in
direction 90, move 10 steps, if on edge, bounce onto the block palette. Change the steps to 13,
but you can adjust it; the higher the number the faster the Ball sprite moves. Stack the steps block on the
if on edge, bounce and then place them within the forever block. It should look like the image
below.

22. On the categories beneath the Script tab, select Sensing to click-and-drag a block that says pick random
__ to __ onto the block palette. Set the numbers to 60 to 280. This will cause the Ball to go in random
directions. Put the block into the point in direction to replace the 90 degrees with the Sensing block.
Stack that block under the one of the when [green flag] checked Place the forever stack underneath.
It should look like the image below.
23. On the categories beneath the Script tab, select Motion to click-and-drag a block that says go to x: __ y:
__ onto the block palette. Set x to 0 and y to 0. Place it under the last when [green flag] checked and
you are done! It should look like image below. Next to the Script tab is an icon of a green flag and a red
octagon. The green icon starts the game, you can move your mouse left and right to move the bar.
Enjoy!

Das könnte Ihnen auch gefallen