Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1”...
Transcript of Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1”...
![Page 1: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/1.jpg)
Make a chasing game with Scratch
1. Start with a sprite
Click on the cat sprite and drag it into the world.
2. Make the cat go forward
Drag into the cat’s PROGRAMS
To try it out, double-click on the block.
3. Move in a different direction
Drag in and type in the number 90.
Snap the blocks together.
Then, double-click (anywhere on the blocks) to see the cat move up.
![Page 2: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/2.jpg)
4. Program the cat to respond to the keyboard
Drag (from the CONTROL blocks) into the cat’s PROGRAMS.
Click and use the pull-down menu
to select “up arrow.”
Snap the blocks together.
Then, press the up-arrow key
on your keyboard.
Does the cat move up?
5. Add keys to make the cat move down, left, and right
Now tell the cat how to move down, left, and right.
![Page 3: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/3.jpg)
Try pressing the arrow keys on your keyboard to make the cat move.
6. Name the cat
Click on the word “sprite1”
and rename it by typing in “cat.”
![Page 4: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/4.jpg)
7. Add a ball for the cat to chase
Click on the paintbrush to make a new sprite.
Draw a ball (any color you want).
Click to save.
Type in the name of your new sprite.
8. Get the ball moving
Drag into the ball’s PROGRAMS.
Change the “10” to a “1” so it says:
.
Drag in (from the CONTROL blocks).
Double-click and watch the ball go forward.
![Page 5: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/5.jpg)
9. Make the ball turn randomly
To make the ball move all around the
screen, drag in
Drag in (from the 1-2-3 blocks).
Then type in the numbers –30 to 30, like
this:
Double-click anywhere on these blocks and watch the ball move randomly around the screen.
Press the arrow keys to make the cat chase the ball.
Save your work so far by clicking on the disk icon, then type in a filename.
(The file will be saved in the Scratch folder.) Click the disk icon whenever you want to save.
![Page 6: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/6.jpg)
10. Make the ball get smaller if the cat touches it
Drag in (from the CONTROL blocks).
Drag in (from SENSING).
Use the pull-down menu to choose “cat”:
Drag in (from LOOKS).
Type in “-10”so it says:
The ball should now shrink each time it touches the cat. (The ball will stop shrinking once it gets really small.)
11. Set the ball back to normal size
Drag in (from LOOKS).
Place at the top of the program. Now, each time the program runs, the ball will be full size.
![Page 7: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/7.jpg)
12. Make the program go
Drag in
(from CONTROL).
Place it at the top of the program.
Now the program will go whenever you click
on the green button:
13. Move the ball away after the cat catches it
Give the ball a chance! After the cat catches the ball, have the ball jump to a different place.
Drag in (from MOTION) to move the ball to the center of the world.
Drag in . Then drag in
(from the 1-2-3 blocks).
Change “10” to “200”, so it looks like this:
.
Now the ball will jump to a random place (within 200 steps of the center) if the cat touches it.
![Page 8: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/8.jpg)
14. Want to keep score?
Here’s how you can add a score to your game.
First, click to select the Background:
Click (in VARIABLES).
For the variable name, type in: “score”.
Then click .
You now have three new blocks to: change the score; set the score; and see the score.
Drag the score block onto the world so you can see it.
![Page 9: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/9.jpg)
Click to select the ball.
Drag in:
(from VARIABLES).
Now, whenever the ball touches the cat, the score will increase by one point.
Click the green button to play:
To reset the score:
drag in (from VARIABLES) and insert it before the forever.
This will set the score to 0 at the beginning of each game (before the ball starts moving).
![Page 10: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/10.jpg)
15. How do you win the game?
To see if you win the game, have the program check the score.
Drag in (from CONTROL).
Insert it inside the forever loop (below the other if).
Drag in (from the 1-2-3 blocks).
Insert in like this:
Drag in (from VARIABLES).
Type in “4” so it says: . This will check to see if the cat catches the ball more than 4 times.
Drag in (from the MOTION blocks). Then type in the message you want to show when you win:
Then, drag in (from CONTROL)so the game will stop when you win.
![Page 11: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/11.jpg)
To make sure the ball doesn’t say anything when the program starts, drag
in and insert it at the top of the program. Leave it blank.
Your game is now ready!
Save your program by clicking on the disk.
Click the green button to play:
15. Customize your game
You can change your chase game however you’d like. Here are some ideas for things to change.
You may want to change how fast the ball moves.
Try typing in a different number.
Want a different character instead of a cat?
Go to the cat’s COSTUMES.
Click to add an image. Or, click to draw a new image.
You will then have two costumes: the new image and the cat costume. If you want to replace or draw on the cat costume, double-click on it.
What else can you chase?
You can also replace the ball with a different costume. Double-click on the ball to change or replace it.
Or, click to add a new image.
![Page 12: Make a chasing game with Scratch - MIT Media Lab€¦ · Web viewClick on the word “sprite1” and rename it by typing in “cat.” Add a ball for the cat to chase. Click on](https://reader034.fdocuments.in/reader034/viewer/2022042318/5f07b34e7e708231d41e4d2b/html5/thumbnails/12.jpg)
To add instructions for your game, first click the paintbrush to add a new sprite.
Then, choose the button, select a color, and type what you want to say.
Click to save. Then, click on the colored text and drag it to where you want it.
The more the merrier--try using the copy tool to make another ball or other sprites. (Use the scissors if you want to delete any.)
You may also want to add a photo or drawing to the background.
Try adding sounds or other special effects.
To save different versions of your program:
First, click the File menu.
Then choose “Save as” and type in a new name for your file.
Experiment and share ideas with others!