Name:

Algorithms Worksheet

Class activity:Writing the algorithm for Sprite 2 in animation 1

Brief:
Two characters glide towards each other
Then have this conversation:
  • “Hello”
  • “Hello”
  • “What are you doing today?”
  • “I’m learning about Scratch.”
/ Algorithm for sprite 1:
When the green flag is clicked:
Go to bottom corner
Glide 2 secs to centre
Say Hello! for 2 secs
Wait 2 secs
Say What are you doing today? for 2secs
Stop Script
Possible code:
Stop script
Wait 2 secs
Say I’m learning about Scratch for 2 secs
Glide to the centre
Go to the bottom
Say Hello for 2 secs
Wait 2 secs / Algorithm for sprite 2:
When the green flag is clicked:

Your plan: write the algorithm byfollowing the storyboard

Storyboard / Algorithm
Animation starts / When the green flag is clicked
Plain background


Note: Eyes are always blinking / Go to the bottom corner
Glide to the centre for 2 secs
Note: (Forever,
Switch to costume 1, wait 0.2 secs
Switch to costume 2, wait 0.2 secs)
Beach background

Forest background

Colour background / Stop Script

You may want to go onto create this animation in Scratch using the techniques from your earlier lessons.

Using broadcast to sequence your animation

Challenge 4

The brief:
  • The two sprites need to continually blink throughout the program.
  • The two sprites need to:
  • start at the bottom
  • glide to the centre
  • say hello to each other
  • One sprite should then say this is where he went on holiday and he likes the forest.
  • The second sprite should then say this is where he went on holiday and he likes the beach.

The algorithms:

Stage:
When green flag clicked:
Switch to background desert
Broadcast conversation 1 and wait
Switch to background forest
Broadcast visit 1 and wait
Switch to background beach
Broadcast visit 2 and wait
Stop all / Sprite 1:
When I receive conversation 1:
Go to bottom corner
Glide to centre
Wait 2 secs
Say Hello! for 2 secs
Stop script
When I receive Visit 2:
Say This is where I went on holiday for 2 secs
Say I like the beach for 2 secs
Stop script / Sprite 2:
When I receive conversation 1:
Go to bottom corner
Glide to centre
Say Hello! for 2 secs
Stop script
When I receive Visit 1:
Say This is where I went on holiday for 2 secs
Say I like the forest for 2 secs
Stop script

You will need to set up three backgrounds – a desert, forest and beach as well as the two sprites.

OLCS Computing