Download presentation
Presentation is loading. Please wait.
1
Scratch: Animation and game programming
Task 7: A fish and a shark
2
Observation and discussion
What can we observe from the demo? How to make it?
3
1. Basic setting How many sprite do we need?
Give it/them name(s) and set rotation. Prepare costumes.
4
2. Let the Shark chase the Fish.
In the script area of shark Let the Shark swim at a random speed and chase the Fish. Remember to change costumes to make the Shark look like chasing.
5
3. Let the player control moving direction of the Fish.
In the script area of fish The player uses direction keys to control the Fish's moving directions. But the Fish will swim by itself. Remember to change costumes to make the Fish look like swimming.
6
4. Add a timing function. In the script area of the Fish.
Set a “variable” to store the time. Variable name: timer
7
4. Add a timing function. Which block can we use to set 20 seconds at the beginning?
8
4. Add a timing function. Then countdown repetitively until down to 0.
Which block can we use to repeat actions until the condition is satisfied?
9
4. Add a timing function. Then countdown repetitively until down to 0.
What can we add in the condition? Timer = 0 ?
10
4. Add a timing function. Then countdown repetitively until down to 0.
Which block can we use to count down?
11
5. Scoring In the script area of the Fish.
Set a “variable” to store scores. Variable name: score Set 10 points at the beginning. Minus 1 point when the Fish is chased by the Shark until score is down to 0. Then stop all actions.
12
6. Problem when scoring! What's wrong? How to solve?
Score deduction is too fast. How to solve? Add waiting time / Appear at another position after touch the Shark.
13
Scripts
14
Scripts
15
Scripts
16
Conclusion: What do we learn?
1. Basic setting How to add sprites, set costumes and edit costumes. 2. Let the Shark chase the Fish. 3. Let the player control moving direction of the Fish. How to set commands.
17
Conclusion: What do we learn?
4. Add a timing function. 5. Scoring Use variable Use repeat-until 1. Initial value 2. Set condition 3. Change value
18
Conclusion: What do we learn?
6. Problem when scoring! How to set commands logically.
19
P.S.1:Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. See P.S.2:Materials are provided by Mr. CHENG Che Hung of NLSI Lui Kwok Pat Fong College.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.