Game Development Reference
In-Depth Information
3.
If so, then we set x to 500 by entering 500 in the set x to () block.
That concludes the first background script. Click on it to test and you will see that nothing
happens. We didn't set the scrolling speed yet, so its value is zero, which means there will be
no movement. As this variable is universal, we will set it in the stage object. We will use the
stage object as a referee, controlling basic values and acions like we did in earlier examples.
1.
Click on the Stage object and go to the Scripts editor.
2.
Start with a when <green lag> clicked block.
3.
Then, we set the scrolling speed to -2 in the set <scrollingSpeed> to () block.
We use a negaive value because we want the background (and all other objects
sill to come) to scroll let.
The following screenshot shows the final script:
That was all we needed to add to make the script work. Let's test it again. We'll see that the
background sliding towards the let unil it is out of view. Then it comes sliding in from the
right again.
 
Search WWH ::




Custom Search