Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

Please note: This theme has not been updated to reflect Scratch 3.0. Visit this help article for more info.

1. Parallax Introduction

Transcript

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)

Next arrow_forward
Instructions
  1. Click the starter project link.
  2. Click remix.
  3. Sign in to Scratch.
Attributions
  • "Parallax Scrolling in Love2d" by GodofGrunts (https://www.youtube.com/watch?v=Qo_wrzTCW-0) -- Licensed by Creative Commons Attribution 3.0 Unported (https://creativecommons.org/licenses/by/3.0/legalcode) -- Video trimmed to needed length, audio removed
  • iutopi by iutopi (https://www.iutopi.com/)
  • Scribbletribe by Scribbletribe (http://www.scribbletribe.com/)