0% found this document useful (0 votes)
33 views8 pages

Starting From SCRATCH: An Introduction To Computing Science - Story Time

Uploaded by

daig0803
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views8 pages

Starting From SCRATCH: An Introduction To Computing Science - Story Time

Uploaded by

daig0803
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Starting from

An Introduction to Computing Science


by Jeremy Scott

Story Time
LEARNER NOTES
Starting from Scratch An Introduction to Computing Science

Acknowledgements
This resource was partially funded by a grant from Education Scotland. We are also grateful for
the help and support provided by the following contributors:

Cathkin High School


Linlithgow Academy
Perth High School
George Heriot’s School
Stromness Academy
CompEdNet, Scottish Forum for Computing Science Teachers
Computing At School
Professor Hal Abelson, MIT
Mitchel Resnick, MIT
Scottish Informatics and Computer Science Alliance (SICSA)
Edinburgh Napier University School of Computing
Glasgow University School of Computing Science
Heriot-Watt University School of Mathematical and Computer Sciences
University of Edinburgh School of Informatics
Robert Gordon University School of Computing
University of Dundee School of Computing
University of Stirling Department of Computing Science and Mathematics
University of West of Scotland School of Computing
International Olympic Committee
ScotlandIS
Turespaña
Brightsolid Online Innovation
JP Morgan
Microsoft Research
Oracle
O2
Sword Ciboodle

The contribution of the following individuals who served on the RSE/BCS Project Advisory Group
is also gratefully acknowledged:

Professor Sally Brown (chair), Mr David Bethune, Mr Ian Birrell, Professor Alan Bundy, Mr Paddy
Burns, Dr Quintin Cutts, Ms Kate Farrell, Mr William Hardie, Mr Simon Humphreys, Professor
Greg Michaelson, Dr Bill Mitchell, Ms Polly Purvis, Ms Jane Richardson and Ms Caroline Stuart.

Some of the material within this resource is based on existing work from the ScratchEd site,
reproduced and adapted under Creative Commons licence. The author thanks the individuals
concerned for permission to use and adapt their materials.

BCS is a registered charity: No 292786


The Royal Society of Edinburgh. Scotland's National Academy. Scottish Charity No. SC000470

i
Starting from Scratch An Introduction to Computing Science

Contents
Introduction .................................................................................................... 5
What is a computer? ...................................................................................... 5
Types of computer ......................................................................................... 6
Parts of a computer ....................................................................................... 9
Hardware ..................................................................................................... 10
Software ....................................................................................................... 11
Programming languages .............................................................................. 12
Programming in Scratch ................................................................................ 13
1: Scratching the Surface ............................................................................... 15
All the world’s a stage .................................................................................. 15
Putting things in order ................................................................................. 17
Did you understand? .................................................................................... 18
Lazy or smart? .............................................................................................. 20
2: Story Time ................................................................................................. 21
Bugs .............................................................................................................. 22
Event-driven programming .......................................................................... 25
3: A Mazing Game ......................................................................................... 27
The Importance of Design ............................................................................ 27
4: Get the Picture? ........................................................................................ 35
Nesting ......................................................................................................... 36
5: Forest Archery Game ................................................................................. 43
Variables....................................................................................................... 46
Summary ...................................................................................................... 49
Scratch Project .............................................................................................. 51
Congratulations ............................................................................................ 60

iii
Starting from Scratch 2: Story Time

2: Story Time

This lesson will cover


x creating stories and plays
x sequencing instructions
x events
x the broadcast command

Task 1: A bad joke


Watch screencast BadJoke. This shows how to use Scratch to create a joke or play
between two characters.

Once you have done this, try creating a joke of your own – for example, a “Knock,
Knock” joke – that uses two characters like the one in the example.

Pay attention to when each character (sprite) “speaks” by planning out the code,
including speaking and waiting, like the one below.

Girl Boy
Say “Hey, I’ve got a joke!” for 3 secs Wait 3 secs
Wait 3 secs Say “Okay – let’s hear it!” for 3 secs
Say “My dog’s got no nose” for 3 secs Wait 3 secs
Wait 3 secs Switch to costume of boy shrugging
Say “How does it smell?” for 3 secs
Say “Terrible” for 2 secs Wait 2 secs
Switch to costume of boy laughing
Say “<Groan>” for 3 secs

2.1 Write down any problems you had and what you did to overcome them.

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

Page 21
Starting from Scratch 2: Story Time

Task 2: A short play


Write a short story or play. There should be two or three scenes (backgrounds) where
the actors (sprites) change costumes.

Keep it simple with only two or three actors (sprites). Write a script on lined paper, with
each actor’s lines side-by-side, as shown in the previous example.

Hint: You can use the broadcast block to let a sprite trigger an event, such as a scene
change e.g.

In the sprite script In the stage script

You can find another screencast (Haunted Scratch) to give you some inspiration at
http://info.scratch.mit.edu/node/165

Extension 1: A walk-on part


Make your characters walk on to the screen and stop at a certain point during the play.

Hint: you will have to start your sprite actors at the edges of the screen and use the
show and hide blocks to make them appear at the correct place every time.

Bugs
A bug is an error which stops your code working as expected. There are two main types
of bug which can occur in a program:
● Syntax error
This happens when the rules of the language have been broken e.g. by mis-
spelling a command. Syntax errors usually stop the code from running.
Languages like Scratch provide code in ready-written blocks, so you won’t make
many syntax errors.
● Logic error
This means your code runs, but doesn’t do what you expect.
Unfortunately, it’s still possible to make logic errors in Scratch!
Finding and fixing these errors in a program is known as debugging.

Page 22
Starting from Scratch 2: Story Time

Did you understand?

2.1 The program below shows the scripts for two sprites to tell a joke to each
other. Why would this program not work?

Girl Boy

__________________________________________________________________

__________________________________________________________________

2.2 The program below shows the scripts for two sprites to tell a joke to each
other. Aside from being a terrible joke, what is wrong with this program?

__________________________________________________________________

__________________________________________________________________

Page 23
Starting from Scratch 2: Story Time

2.3 The program below shows the scripts for two sprites to tell a joke to
each other. Why would this program not work?

Girl Boy

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

2.4 Now make up a “buggy” question of your own and pass it to your neighbour.

Page 24
Starting from Scratch 2: Story Time

Event-driven programming
Some computer programs just run and continue on their own with no input from the
user e.g. your program to play a tune.
However, many programs react to events (things that happen), such as:
● the click of a mouse or press of a key;
● the tilt of a game controller;
● a swipe of a smartphone screen;
● a body movement detected by a motion-sensing controller such as a Kinect

In Scratch, event blocks have a curved top (sometimes called a “hat”):

Reacts when the green flag is clicked.


Often used to start a program.

Reacts when a key is pressed. Click the small black


triangle to select the key you want to detect. Useful for
controlling a sprite, or triggering an action.

Reacts when a sprite is clicked. Useful for controlling


characters in a program.

It is also possible to create your own events in Scratch using the broadcast command.

2.4 Look at the Scratch environment and write down some other events or conditions
that Scratch programs can react to.
Hint: the Control and Sensing blocks are a good place to start.

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

Page 25

You might also like