Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms in Scratch How to plan your code. Algorithms Algorithms provide computers with a set of instructions or a set of rules. They are written BEFORE.

Similar presentations


Presentation on theme: "Algorithms in Scratch How to plan your code. Algorithms Algorithms provide computers with a set of instructions or a set of rules. They are written BEFORE."— Presentation transcript:

1 Algorithms in Scratch How to plan your code

2 Algorithms Algorithms provide computers with a set of instructions or a set of rules. They are written BEFORE the code is written.

3 Do you recognise this algorithm? 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

4 Can you write the opposite part of the conversation? The brief: Can you make this animation so that: Two characters glide towards each other Then have this conversation: “Hello” “What are you doing today?” “I’m learning about Scratch.” I’ll start you off: When the green flag is clicked:

5 Can you write the opposite part of the conversation? Finished algorithm: When the green flag is clicked: Go to the bottom Glide to the centre Wait 2 secs Say “Hello” for 2 secs Wait 2 secs Say “I’m learning about Scratch” for 2 secs Stop script

6 Student activity – create the algorithm Look carefully at the storyboard and write the algorithm that will help you with the code.

7 Broadcasting events We can use broadcasting to sequence our animation. Watch scratch animation 4 as this uses broadcast events. Here the stage controls the sequence of events. Each event starts (when I receive..) after the stage has broadcast the event name.

8 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.

9 Challenge 4 – the algorithms to help you 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 You will need to set up three backgrounds – a desert, forest and beach as well as the two sprites. 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


Download ppt "Algorithms in Scratch How to plan your code. Algorithms Algorithms provide computers with a set of instructions or a set of rules. They are written BEFORE."

Similar presentations


Ads by Google