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 Scroll is like my momEdit
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 Method is the mom food 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 mom eat their mom. 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:
And on the second sprite script this:
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:
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:
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:
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.