Scrolling is the illusion of movement created by the background moving. This causes the character sprite to appear to be moving farther than possible in the bounds of the screen (480 x 360).

How to ScrollEdit

There are many methods of scrolling in Scratch. This is because some methods can be used for certain game play, such as multiple directions, or multiple appearances.

The Traditional MethodEdit

This is the most commonly used method of scrolling. It features scrolling on the X-axis, the preferred axis for most backgrounds. This method involves multiple sprites. It requires a variable (it is most commonly called Scroll or Scroll X), and more than one background sprite which you want to scroll. On the first sprite build this script:

Simple Scrolling Script example

And on the second sprite script this:

Simple Scrolling Script example 2

For each sprite just change the number you multiply 480 with by 1. Make sure the first sprite starts with 0 and not 1.

Also, on each sprite you will need this script:

Side Sensing (revised)

You will also need some way of changing the variable, so that everything actually moves.

The number 480 can be replaced with something else depending on the width of screen that you want the sprites to scroll across.

X and Y ScrollingEdit

This is exactly the same as the Traditional Method except you can scroll upwards as well as across. You will need more scripts just like the ones above except with a different variable, and you will have to replace the number 480 with the height of the area you want to scroll in.

Two Player ScrollingEdit

First of all on Player One put this script or a similar script depending on how large each portion of screen for each player is, what colour the ground is, what keys you want to be pressed, how much you want the variables to be changed by and what the variables are called:


Then on player two put the same script except with a different variable and different keys which are pressed.

On the duplicate of player one that you will put in player two's portion of the screen put this script in: 02
Put exactly the same script on the duplicate of player 2 except with (y position of player 2) rather than (y position of player 1).

For player 1's terrain use exactly the same method as the Traditional Method except use your variable for player 1's scrolling. The same goes for player 2 except with player 2's scrolling variable.

Community content is available under CC-BY-SA unless otherwise noted.