User Guide

104
1. In the Sprite List, click Stage.
2. In the Blocks Palette, click Variables, and then click
Make a variable.
3. In the Variable name box, type scrollX and then
click OK.
4. In the Blocks Palette, click the box next to scrollX.
When the title screen broadcasts the message “Level1” to start
the game, the first background sprite should make itself visible.
Add the following script to the L1M1 sprite:
Since the first background sprite starts in the center of the Stage,
its x position is 0 - scrollX. So if scrollX is 10, then the x position
is -10. This is how increasing the value of scrollX causes the
background sprites to move to the left.
Copy that script into L1M2. Since L1M1 starts at coordinate 0,0
and is 480 steps wide, L1M2 starts at 480,0. So you need to
change the value in the set x to block to 480 - scrollX.
Copy that script into L1M3. Since L1M2 starts at 480,0 and is 480
steps wide, L1M3 starts at 960,0. So change the set x to block to
960 - scrollX.
Copy the script into the next background sprite, L1M4. This
starts at 1440,0. So change the set x to block to 1440 - scrollX.
The last background sprite is different. Because it is less wide
than the others, its start point is 1735,0. And when this sprite is
at coordinate 195,0 it is fully on-screen. As the last sprite in the
chain, L1M5 must stop any more scrolling from happening. To
do this, create a variable called CanScroll: