Hey!
And welcome to activity four of Google CS First animation.
In this activity you will build
a parallax scrolling animation,
while you learn about
the important computer science concept,
local vs. global variables.
Parallax describes the effect
in which things that are closer,
appear to move faster than things that are farther away.
Animators imitate parallax with an awesome effect,
called parallax scrolling.
In parallax scrolling,
objects closer to the front are animated
to move faster than objects farther away.
This effect is used in games
and even websites.
It gives the illusion of depth,
in a side scrolling animation.
It makes viewers feel like they're part
of a three dimensional world.
To build your parallax project,
you'll create local rather than global variables.
Global variables are for all sprites.
Local variables are for this sprite only.
The global option is selected by default
when you create a variable in Scratch.
If a sprite needs its own variable
or if each clone of a sprite
needs its own private copy of a variable,
you will use a local variable.
Today you'll create clones
that each use their own local variable.
For example,
in this Scratch game, global jump is a global variable.
All sprites in the project share this variable.
The code says, when the left arrow key is pressed,
glide up and down the number of steps
in the global jump variable.
When the left arrow key is pressed,
all sprites jump the same amount.
Local jump is a local variable.
Each sprite in this project
has its own local jump variable.
When the right arrow key is pressed,
each sprite moves up the value in the local jump variable.
(upbeat music)
In this activity, you'll use a local variable,
to control how far away each object appears in the scene.
To start click the starter project link.
And sign into Scratch.
Click Remix.
Then return to CS First to watch the next video.
The videos for this activity build in this starter project.
But you'll choose your own from the options
next to this video.
Take a look.
(upbeat music)