Example: dental hygienist

FLAPPY CAT - cougarstechterritory.pbworks.com

FLAPPY Cat - Scratch coding tutorial by MQUIZ Page 1 Description: Learn how to code in Scratch* a simplified version of the popular FLAPPY Bird iPhone game. Activity Time: 35-55 minutes Difficulty: 6 out 10 FLAPPY CAT *Scratch is a free online programming language especially for ages 8 to 16, created by the MIT Media Lab. Page 2 FLAPPY CAT The goal is to fly the Cat through the gap in the red pipe . Click the Green flag to start the game. Press the Space bar to make the Cat go up. Release the Space bar to let the Cat slowly fall down. If the Cat touches the red pipe , it s Game Over! The longer you stay in the game, the higher your score will be. How to play: FLAPPY Cat - Scratch coding tutorial by MQUIZ START 1. Go to 2. Sign in or Join Scratch if you haven t done it yet Page 3 3.

Page 2 FLAPPY CAT The goal is to fly the Cat through the gap in the red pipe. Click the ZGreen flag to start the game. Press the Space bar to make the Cat go up. Release the Space bar to let the Cat slowly fall down. If the Cat touches the red pipe [, it [s Game Over! The longer you stay in the game, the higher your score will be.

Tags:

  Make, Games, Flappy

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of FLAPPY CAT - cougarstechterritory.pbworks.com

1 FLAPPY Cat - Scratch coding tutorial by MQUIZ Page 1 Description: Learn how to code in Scratch* a simplified version of the popular FLAPPY Bird iPhone game. Activity Time: 35-55 minutes Difficulty: 6 out 10 FLAPPY CAT *Scratch is a free online programming language especially for ages 8 to 16, created by the MIT Media Lab. Page 2 FLAPPY CAT The goal is to fly the Cat through the gap in the red pipe . Click the Green flag to start the game. Press the Space bar to make the Cat go up. Release the Space bar to let the Cat slowly fall down. If the Cat touches the red pipe , it s Game Over! The longer you stay in the game, the higher your score will be. How to play: FLAPPY Cat - Scratch coding tutorial by MQUIZ START 1. Go to 2. Sign in or Join Scratch if you haven t done it yet Page 3 3.

2 Click Create FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 4. Click the Paint new sprite icon. We ll create the pipe (Sprite 2) that the Cat will fly through. Page 4 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 5. Click the Rectangle tool (1), select the filled-in option (2) and select a color (3) (red for example) Page 5 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 6. Draw a rectangle. make sure you draw the rectangle with a big-enough length to cover the whole screen from top to bottom. Page 6 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 7. Use right-click / duplicate to copy the rectangle (costume 1) and create 4 more identical rectangles (costume2, costume3, costume4 and costume5), like in the image below.

3 Page 7 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 8. Select the first rectangle (costume 1) (1), click on the Select tool (2) then select an area within the red rectangle (3). Click Delete on your keyboard to delete the selected area. This will be the gap in the pipe that the Cat will fly through. Page 8 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 9. After completing the step 9, the first rectangle (costume 1) and its gap should look like this. Page 9 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 10. Repeat steps 9 and 10 for the other 4 rectangles (costume2, costume3, constume4 and costume5), but make sure you make the gap at a different positions (higher or lower) for each rectangle. Page 10 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 11.

4 make sure the pipe (Sprite 2) is selected (1) and click the Scripts tab (2). In the next step we start adding scripts (code) to the pipe (Sprite 2). Page 11 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 12. Add the following script to the pipe (Sprite 2). Page 12 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ After I click the green flag to start the game, do this forever: -Go to x=250 and y=0 These are the starting coordinates for the red pipe. Remember - The x coordinates of the screen are between -240 and 240. A starting coordinate of x=250 means that the pipe will start from a position just outside the right-edge of the screen. -Switch randomly to one of the 5 costumes. Selecting randomly one of the 5 costumes will ensure the gap in the pipe will show at different positions.

5 -Repeat 100 times changing x by -5 points. Changing x by a negative value means moving to the left. Moving 5 points to left for 100 times it means moving at a distance of 500 points to the left from the starting point of x=250. This would take the red pipe to x=-250 (negative 250) which is just outside the left-edge of the screen. -After repeating moving 5 points to the left for 100 times and the red pipe reached the left-edge of the screen, we start the forever loop again by selecting a random costume, positioning the red pipe on the right-edge of the screen and again start moving 5 points to the left for 100 times until we reach the left-side of the screen again. And then Explaining the code Page 13 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 13. Click the Green Flag to start your game and test your code so far.

6 make sure the pipe (Sprite 2) starts from the left side of the screen and glides all the way to the right side of the screen. It should do that again and again, until you click the red Stop button to stop the program. make sure that every time a random costume of the pipe is being displayed, showing the gap in the pipe at different positions. Page 14 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 14. make sure the Cat (Sprite 1) is selected (1) and click the Script tab (2). In the next step we start adding code to the Cat (Sprite 1). Page 15 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 15. Add the following script to the Cat (Sprite 1). Page 16 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ After I click the green flag to start the game: -Go to x=-100 and y=0 This will ensure your Cat is positioned at the center-left of the screen -Do this forever: -If you tap the Space bar on your keyboard, make the Cat jump up 7 steps.

7 -Else let the Cat free-fall 3 steps. Explaining the code Page 17 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 16. Add the additional script (1) to the Cat (Sprite 1). Click on the new (2) then type Game Over in the box (3) and click OK (4). Page 18 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ -If the Cat (Sprite 1) touches the pipe (Sprite 2) then send a message called Game Over . -Notes: Sending a message is Scratch is called Broadcast . When you send a Broadcast message in Scratch, the message is sent to all the other Sprites or Backdrops in your code. We will add later the code to listen to our Game Over message. Explaining the code Page 19 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 17. Next, lets add a variable for keeping the Score of our game.

8 Add the following script to the Cat (Sprite 1). Click on Data (1) then click on the make a Variable (2) button, type in Score (3) in the box, select For all sprites (4) and click OK. (5). Page 20 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 18. You should now see the Score box (variable) in your game. Page 21 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 19. Add the additional script (1) to the Cat (Sprite 1). Page 22 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ After I click the green flag to start the game: -Set the Score to 0 This will ensure that every time you start a new game, your score will start from 0. -Do this forever: After every seconds, increase your Score by 1. This will ensure that the longer a player stays in, the game the higher the score.

9 Explaining the code Page 23 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 20. Next lets add a backdrop to your game. Click on the Choose backdrop from library. Page 24 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 21. Select a backdrop (for example: blue sky) and click OK. Page 25 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 22. Your backdrop should now appear in your game. Page 26 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 23. make sure the Backdrops tab (1) is selected. Right-click and duplicate (2) to copy your backdrop. Page 27 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 24. Select the copied backdrop (1). Click on the T text tool (2) and type Game Over (3) We will display this backdrop to let the use know when the game is over.

10 Page 28 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 25. make sure your backdrop is selected (1) and click the Script tab (2). In the next step we ll add some code to the backdrop. Page 29 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 26. Add the following script to the backdrop. Page 30 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ After I click the green flag show the backdrop without the text Game Over written on it. But when I receive the broadcast message Game Over then show the backdrop with the text Game Over written on it. After that stop all the scripts (stop the game). Explaining the code Page 31 FLAPPY CAT FLAPPY Cat - Scratch coding tutorial by MQUIZ 27. Test you game. make sure your Cat (Sprite 1) is small enough to go through the gap in the pipe.


Related search queries