10
COMPUTING VARIABLES AND BROADCASTING

Ei505 variables & broadcasts session 3

Embed Size (px)

Citation preview

Page 1: Ei505 variables & broadcasts   session 3

COMPUTING

VARIABLES AND BROADCASTING

Page 2: Ei505 variables & broadcasts   session 3

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.

Page 3: Ei505 variables & broadcasts   session 3

UNDERSTANDING VARIABLES

“Variables work like labelled boxes that allow you to store things

inside them to retrieve later.”

identifier

data

Page 4: Ei505 variables & broadcasts   session 3

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/

Page 5: Ei505 variables & broadcasts   session 3

UNDERSTANDING VARIABLES

Page 6: Ei505 variables & broadcasts   session 3

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’

Page 7: Ei505 variables & broadcasts   session 3

BROADCASTING

Page 8: Ei505 variables & broadcasts   session 3

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.

Page 9: Ei505 variables & broadcasts   session 3

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/