CREATE YOUR FIRST GAME In the first project, Dancing Cat, you discovered how to control a Sprite by stacking blocks in a certain sequence. In this project you will build on those skills. Use Control, Sensing, and Looks blocks to make the mouse appear to be eaten when touched by the cat. Start Scratch 10/18/14 Download Instructions Need Help? NEW CONCEPTS LEARN HOW TO: NEW BLOCKS INTRODUCED: ADD NEW SPRITES TO THE GAME STAGE GIVE SPRITES MOVEMENT CONTROL SPRITE ACTION DURING A GAME The Forever block gives a sprite continuous instruction. Whatever is contained in the Forever block is run all the time. With the If … Then block the sprite makes a decision based on a condition you, the game builder, set when you create the game. The block tells the Sprite to perform an action if the condition is true. The light blue Sensing blocks set the condition where a change is made to the sprite’s movement. 10/18/14 ADD CAT GAME SPRITE TOOLS YOU WILL NEED You need a Cat and a Mouse for this game. You can change or add sprites using the Sprite Library. First, delete the default cat sprite. We are going to use a different cat sprite for this game. Right click on the sprite and select delete from the list that appears. Now click the Choose Sprite from Library button. Select the Animals category. The Cat2 sprite looks like a cat that would chase a mouse! Double-click on Cat2. Notice that your new sprite is automatically added to the stage. 10/18/14 ADD CAT CONTROLS BLOCKS YOU WILL NEED Now it is time to build the code for the cat. In this game you want to make the cat move and bounce if it touches a wall. The cat should do these two things forever. To start we will give you the exact instructions : Click the Events block option. Drag the When block over into the script area. Clicked Next, drag the Forever block to the script area and snap it below the When Clicked block. Drag a Move … Steps block to the script area and snap it inside the Forever block. Leave the number of steps at 10. Finally, drag the If On Edge, Bounce block and snap underneath the Move <> Steps block. This tells the sprite to turn and run in another direction when it touches the edge of the stage. After all, we don’t want the cat running off the stage out of the game! Click on the green Show Me button to see the solution 10/18/14 Show Me ADD MORE CAT CONTROLS BLOCKS YOU WILL NEED Now you need to take control of the cat. Add blocks that make the cat turns left or right if when it senses that the left and right arrow keys have been pressed. Drag your blocks to the stage. You need two If … Then blocks and two of the Key … Pressed? Blocks for a total of 6 blocks. On the Key … Pressed? Blocks. Click the small black down arrow and select Right Arrow in one of the blocks and Left Arrow in the other block. Drop them in between the If and Then in each of the If … Then blocks. Add the Turn (left) … Degrees block inside the If … Then block with the Left Arrow sensing block. Do the same for the Turn (right) … Degrees block 10/18/14 Show Me COMPLETE AND TEST CAT CONTROLS BLOCKS YOU WILL NEED Final Assembly is easy. Drop the If … Then block sets inside the forever block so you evaluate the if condition all the time. Here is what your finished block of code should look like to give the cat movement during the game. Try it! Click the green flag above the stage to start the cat moving. Use the left and right arrow keys to turn the cat left and right. 10/18/14 ADD MOUSE GAME SPRITE TOOLS YOU WILL NEED Now add a mouse sprite to the game. Use the Sprite Library just as you did for adding the cat sprite. Click the Choose Sprite from Library button. Select the Animals category. Double-click on Mouse1. Notice that your new sprite is automatically added to the stage. 10/18/14 ADD MOUSE CONTROLS BLOCKS YOU WILL NEED Now it is time to program the mouse movement. Before you start dragging blocks, make sure the Mouse sprite is selected! For this step we just want the mouse to move on its own, forever. At this point, you should be able to do this on your own. To get help or check your work click on the Show Me button. Here are a few hints: Don’t forget to start the script with a When Clicked block. Make sure the Move is inside the Forever Block. Click on the Show Me button to check your work. Show Me 10/18/14 ADD MORE MOUSE CONTROLS Let’s building the smarts into the mouse sprite. BLOCKS YOU WILL NEED Here we want the Mouse to sense 3 conditions and do something. 1. If the mouse touches the edge turn 40 Degrees so he does not run off the stage. 2. If the cat touches the mouse hide the mouse so it looks like the cat ate the mouse. 3. If the space key is pressed restart the game. To restart the game simply show the mouse again. Here are some hints: Show Me 10/18/14 COMPLETE MOUSE CONTROLS BLOCKS YOU WILL NEED Final Assembly is easy. Drop the If … Then block sets inside the forever block so you evaluate the if condition all the time. Here is what your finished block of code should look like to give the mouse movement during the game. Try it! Click the green flag above the stage to start the cat moving. Use the left and right arrow keys to turn the cat left and right. 10/18/14 PLAY THE GAME Try it! Click the green flag above the stage to start the cat and mouse moving. Use the left and right arrow keys to turn the cat toward the mouse. If the cat eats the mouse, use the space bar to bring the mouse back to life. 10/18/14 10/18/14
© Copyright 2025 Paperzz