+ All Categories
Home > Documents > Lesson 5 Underwater Game - Chulmleigh ICT...

Lesson 5 Underwater Game - Chulmleigh ICT...

Date post: 16-Sep-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
16
Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game Introduction to Scratch Programming (2 nd Edition) Page 1 of 16 © ZigZag Education, 2013 Lesson 5 – Underwater Game This exercise is a consolidation of previous learning. A shark chases a diver around the screen. The exercise includes: importing sprites drawing costumes animating sprites using scripts controlling the movement of sprites by the user automatic sprites interaction between sprites using variables to create a scoring and a countdown Contents Exercise 1 – Creating the Diver Sprite ......................................................................................................... 2 Exercise 2 – Creating the Shark Sprite ........................................................................................................ 8 Exercise 3 – Creating the Countdown and Shark Scripts ............................................................................ 9 Exercise 4 – Making the Shark Eat the Diver ..............................................................................................11 Exercise 5 – Introduce Scoring into the Game........................................................................................... 12 Exercise 6 – Inserting a Background .......................................................................................................... 13 Exercise 7 – Introduce Obstacles in the Game .......................................................................................... 14
Transcript
Page 1: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 1 of 16 © ZigZag Education, 2013

Lesson 5 – Underwater Game

This exercise is a consolidation of previous learning. A shark chases a diver around the screen.

The exercise includes:

importing sprites

drawing costumes

animating sprites using scripts

controlling the movement of sprites by the user

automatic sprites

interaction between sprites

using variables to create a scoring and a countdown

Contents

Exercise 1 – Creating the Diver Sprite ......................................................................................................... 2

Exercise 2 – Creating the Shark Sprite ........................................................................................................ 8

Exercise 3 – Creating the Countdown and Shark Scripts ............................................................................ 9

Exercise 4 – Making the Shark Eat the Diver .............................................................................................. 11

Exercise 5 – Introduce Scoring into the Game ........................................................................................... 12

Exercise 6 – Inserting a Background .......................................................................................................... 13

Exercise 7 – Introduce Obstacles in the Game .......................................................................................... 14

Page 2: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 2 of 16 © ZigZag Education, 2013

Exercise 1 – Creating the Diver Sprite

1. Open Scratch.

2. Using the scissor tool, delete the cat.

Page 3: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 3 of 16 © ZigZag Education, 2013

3. Click the centre button: Choose new sprite from file.

4. Choose the People folder and browse for diver1.

The diver is now introduced into the stage in Scratch.

Page 4: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 4 of 16 © ZigZag Education, 2013

5. Click the Costumes tab and then click Import.

6. Browse for diver2.

Now you have two costumes for the diver.

7. Click the Edit button next to diver1.

Page 5: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 5 of 16 © ZigZag Education, 2013

8. Working in Paint Editor, change the colours so that diver1 matches diver2.

There are now two costumes with the diver in different positions.

Page 6: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 6 of 16 © ZigZag Education, 2013

9. Click the only face left-right button and rename the sprite as Diver.

10. Click on the Scripts tab. 11. From the Control (orange) and Looks (purple) menu, create the script as illustrated. 12. Remember to set the wait time to 0.1 seconds. 13. Remember to set the switch to costume commands to diver1 and diver2.

14. Click the green flag above the stage – the diver should animate.

Page 7: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 7 of 16 © ZigZag Education, 2013

15. To make the diver move around the screen using the arrow keys, create the script illustrated. Make sure that each if statement is stacked one over the other and NOT one within the other.

You should be able to drive the diver around the screen using the arrow keys.

Page 8: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 8 of 16 © ZigZag Education, 2013

Exercise 2 – Creating the Shark Sprite

1. Click the centre button below the stage: Choose new sprite from file.

2. Select the Animals folder and browse for shark1-a.

3. Click the Costumes tab. 4. Click Import. 5. Browse for shark 1-b. 6. Import the sprite as a costume. 7. Use a script to animate the shark.

Page 9: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 9 of 16 © ZigZag Education, 2013

Exercise 3 – Creating the Countdown and Shark Scripts

In order for the project to be a game, we need to introduce some sort of challenge – a time limit or countdown and a score.

1. Click the Variables (red) tab. 2. Click Make a variable. 3. Name the variable as countdown.

You now have some countdown commands that you can use in your scripts.

4. Working on the shark sprite, rename the sprite and set the only face left-right button.

Page 10: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 10 of 16 © ZigZag Education, 2013

5. Create the scripts as shown:

This command sets the score to 10.

This command counts down by 1. each second

This command stops the countdown when it gets to zero.

This command sets the position of the shark when the game starts.

This command makes the shark move continuously.

This command makes the shark bounce off the edge and chase after the diver.

This command animates the shark.

This makes the shark point left or right only.

Page 11: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 11 of 16 © ZigZag Education, 2013

Exercise 4 – Making the Shark Eat the Diver

1. Click on the diver sprite and select the Costumes tab.

2. Create a new costume. 3. Rename the costume diver3 to diverdead and click Edit. 4 In Paint Editor, make the diver dead! 5. Amend the diver script as shown.

6. Use the shrink sprite tool to reduce the size of the diver and shark.

7. Test the game.

Page 12: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 12 of 16 © ZigZag Education, 2013

Exercise 5 – Introduce Scoring into the Game

1. Click the centre button below the stage: Choose new sprite from file. 2. Browse and choose key1 from the Things folder.

3. Create a new variable called Score.

4. Rename the sprite as GoldenKey and create the script as illustrated.

Page 13: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 13 of 16 © ZigZag Education, 2013

Exercise 6 – Inserting a Background

1. Double-click the Stage icon and then click the Backgrounds tab.

2. Click Import and browse the Nature folder for the underwater background.

Page 14: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 14 of 16 © ZigZag Education, 2013

Exercise 7 – Introduce Obstacles in the Game

1. Click the centre button below the stage: Choose new sprite from file. 2. Select two fish from the Animals folder; rename as fish1 and fish2. 3. For each fish, create the script illustrated. 4. Remember to select the only face left-right option.

fish1 should move across the screen from left to right and fish2 from right to left.

5. Click the diver sprite and amend the movement script (diver bounces off fish).

Page 15: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 15 of 16 © ZigZag Education, 2013

6. Click the shark sprite and amend its movement script (shark bounces off fish).

7. Ensure that the sprites are all made quite small.

Page 16: Lesson 5 Underwater Game - Chulmleigh ICT Departmentchulmleighict.weebly.com/uploads/1/4/1/8/14183906/_5.pdf · 2020. 2. 18. · Introduction to Scratch Programming v1.4 (Second Ed)

Introduction to Scratch Programming v1.4 (Second Ed) 5 – Underwater Game

Introduction to Scratch Programming (2nd Edition) Page 16 of 16 © ZigZag Education, 2013

You have made a game! Click the switch to presentation mode button to play the game.

Now apply what you have learned and make your own game.

Set the countdown to a higher setting.


Recommended