FANDOM


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 (480x360).

How to ScrollEdit

There are many methods of scrolling in Scratch. This is because some methods can be used for certain gameplay, 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 platformers. This method involves multiple sprites. It requires a variable (it is most commonly called Scroll or ScrollX), 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

Two Player Scrolling is split screen scrolling. So one player is on the top and one on the bottom, and they are controlled differently, but they are in the same landscape with the same backgrounds. First of all you will need to make the background sprites, and then duplicate them for the second player. The variables you need are a scroll variable for player 1 and a scroll variable for player two. You will need to duplicate player one and player two so that they can go on both screens.

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:
lol
01

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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.