+ All Categories
Home > Documents > Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access...

Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access...

Date post: 13-Aug-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
18
Computing Science Scratch Programming
Transcript
Page 1: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

Computing Science

Scratch Programming

Page 2: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

2

Creating an Account

1. Access Scratch here: https://scratch.mit.edu/

2. Sign up for an account by clicking Join Scratch.

Don’t use your real name as your username.

3. Use your Glow email address:

[email protected]

You will have to log in to your Glow emails

Click on the link you will be sent to confirm you

Scratch account

4. If you forget your username or password, you can

click the need help button when you sign in.

Page 3: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

3

Worked

Example

1

Page 4: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

4

Worked Example 1: Using Flow Charts

What is a Flow Chart?

A flow chart is a design technique used to show the sequence of steps to be

followed by a program.

Different shapes are used to indicate different types of instruction.

Rounded rectangle:

start of a program

Rectangle:

A normal instruction

Parallelogram:

An input (type something)

Rectangle:

A normal instruction

Parallelogram:

An output (display a message)

Rounded rectangle:

start of a program

Arrows: Point to the next instructions. This shows

the sequence of steps the program will follow.

What is an Algorithm?

An algorithm is a sequence of steps that describe how to solve a problem.

The flow chart above is an example of an algorithm.

Page 5: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

5

Design

The first thing to do when creating a program is to design the steps that the program

must follow. We can do this with a flow chart.

Step 1 The program starts. Step 2 The character should be set to 100% size. Step 3 The character should turn to face the right. Step 4 The program must display a message saying “Hello World” This is called an OUTPUT. Step 5 The program plays a “Meow” sound. Step 6 The program waits for 1 second. Step 7 The character should turn to face the left. Step 8 The character size should be set to 200%. Step 9 The program ends.

Page 6: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

6

Converting Design to Code

We can now use the design we created to write the Scratch code needed to make

the program work.

You can see below how the flow chart shapes can be converted into the correct

Scratch blocks.

Flow Chart (Design) Scratch (Code)

Page 7: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

7

Task 1a

Watch the Worked Example 1.mp4 video.

Follow the instructions on the next 3 pages to:

• Write the Scratch code

• Test your program

Writing the Code: Step-by-Step Guide

Step 1

Click Find Drag it into the middle area

Step 2

Click Find Drag it into the middle area and connect it to the green flag block.

Step 3

Click Find Connect it to the size block and change its value to 90.

Page 8: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

8

Step 4

Click Find

Connect it to the direction block and change its text to “Hello World”.

Step 5

Click Find

Connect it to the say block.

Step 6

Click Find Connect it to the sound block.

Step 7

Click Find Connect it to the wait block and leave its value as -90.

Page 9: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

9

Step 8

Click Find Connect it to the direction block and change its value to 200.

Testing the Code

1. Run the program by clicking on the green flag at the top

on the stage area.

2. Check that scratch does the following:

• Size changes to 100% (run the program twice to check this)

• Turns to the right (run the program twice to check this)

• Says “hello world”

• Plays the “meow” sound

• Waits for a second

• Turns to the left

• Doubles in size

3. Try running the program again to make sure it follows .

Page 10: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

10

Saving the Code (to a computer)

1. Give the project a name that matches the name of the task.

2. Click on File – Save to your computer.

3. At the bottom of the browser, click on the arrow next to your download and click

Show in Folder.

4. Right click on the download and copy it to a folder that you keep all your

projects in (you will have to make a folder somewhere).

Page 11: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

11

Saving the Code (using a tablet or phone)

1. Give your project a name that matches the task.

2. Click on the Save Now button

3. Click on the folder icon to see your projects.

4. Select a project the click on See Inside.

Page 12: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

12

Worked

Example

2

Page 13: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

13

Worked Example 2: Colour and Turn

Read the description below of the problem we are going to solve.

Problem Description

A program is required that will do the following each time the green flag is clicked:

• Change the colour of Scratch to blue.

• Display the message, “I love coding” for 2

seconds.

• Change direction by 900 to the right.

• Change the colour of Scratch back to normal

• There should be a 1 second delay between each instruction.

Page 14: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

14

Design

The first thing to do is to design the steps that the program will follow. We can do this

with a flow chart.

Step 1 The program starts. Step 2 The program changes the character’s colour to blue. Step 3 The program must wait for 1 second. Step 4 The program must display a message saying “I love coding”. This is called an OUTPUT. Step 5 The program must wait for 1 second. Step 6 The program rotate the character by 900 to the right. Step 7 The program must wait for 1 second. Step 8 The program changes the character’s colour to back to normal. Step 9 The program ends.

Page 15: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

15

Converting Design to Code

We can now use the design we created to write the Scratch code needed to make

the program work.

You can see below how the flow chart shapes can be converted into the correct

Scratch blocks.

Flow Chart (Design) Scratch (Code)

Task 2a

• Watch the Worked Example 2.mp4 video.

• Put the code together in the order shown above connecting all the blocks

together. (You can follow the instructions on the next 2 pages to help if you need to)

THEN

• Test your program (see page 17)

Page 16: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

16

Writing the Code: Step by Step Guide

Step 1

Click Find Drag it into the middle area

Step 2

Click Find Connect it to your green flag block. Change the effect number 100.

Step 3

Click Find Connect it to the set colour block.

Step 4

Click Find

Connect it to the wait block and change the message to “I love coding”

Page 17: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

17

Step 5

Click Find Connect it to the say block.

Step 6

Click Find Connect it to the wait block. Change the degrees value to 90.

Step 7

Click Find Connect it to the turn block.

Step 8

Click Find Connect it to the wait block.

Page 18: Scratch Programming - Glow Blogs€¦ · Scratch Programming . 2 Creating an Account 1. Access Scratch here: 2. ... We can now use the design we created to write the Scratch code

18

Testing the Code

1. Run the program by clicking on the green flag at the top on

the stage area.

2. Check that scratch does the following:

• Changes colour to blue.

• Displays the message, “I love coding” for 2 seconds.

• Changes direction by 900 to face downwards.

• Changes colour back to normal.

• Waits 1 seconds between each of the above.

Test the program 4 times to check that Scratch returns to the starting position.

Save the Code

Give the project the name, Worked Example 2 and save it.


Recommended