Upload
lisbundock
View
157
Download
1
Embed Size (px)
Citation preview
COMPUTING
VARIABLES AND BROADCASTING
VARIABLES
“work with variables” - Subject content KS2
Variables are containers for data. They enable us to
store, retrieve or change data. A variable could be
used in a game to keep track of a user’s score or to
remember a player’s name.
UNDERSTANDING VARIABLES
“Variables work like labelled boxes that allow you to store things
inside them to retrieve later.”
identifier
data
VARIABLES
Explore how this simple project uses a variable to store and then retrieve a user’s name.
Can you add the necessary code to the project to store and retrieve the user’s age?
http://scratch.mit.edu/projects/50476486/
UNDERSTANDING VARIABLES
BROADCASTING
You can think of broadcasting
as being the way in which
sprites communicate with each
other.
A broadcast is a message that
is sent from the code attached
to one sprite to activate code
that is attached to other sprites.
Broadcasts are useful in games
and animations as they trigger
specific scripts.
Broadcasts are sent and received
using blocks found in ‘Events’
BROADCASTING
CHRISTMAS TREE
How has the broadcasting
feature been used to change the
backdrop and the sprite
costumes?
Can you make the buttons hide
when the user clicks the DONE
button? Make sure you use
broadcasts to achieve this.
PUTTING IT ALL TOGETHER
This game works but it could so
with some extra features.
Can you award the user a point for
every apple they catch in the
basket? Can you add a GAME
OVER background and switch to
this when three apples have hit the
ground?
http://scratch.mit.edu/projects/1431
9469/
FOLLOW UP
Join: http://barefootcas.org.uk/
Read this resource on variables:
http://barefootcas.org.uk/programme-of-
study/work-variables/variables/
Read this resource on broadcasting:
http://wiki.scratch.mit.edu/wiki/Broadcast