Game Development Reference
In-Depth Information
Engage thrusters
Let's move on to the scriping. We will use the cloning method again to create muliple
objects from a base sprite shown as follows:
1. As usual we start with a when <green lag> clicked block.
2. First, we click on hide to hide the original sprite from view.
3. Then, we make it go to front to place it on top of everything else using the go to
front block.
4. Next, we make it go back five layers by entering 5 in the go back () layers block.
This is to make sure that the sprite will be at the depth where we want it
to be. If the sprites are not layered properly, the parallax effect will look weird.
5. We posiion the sprite at its staring place with a go to x: () y:() command; enter 240
and -150 respecively.
6. This sprite also needs its personal speedMultiplier variable, just like the
background images.
7. Ater creaing the variable, we set its value to 2 .
8. After this, we will start the forever loop, which will spawn the clones.
9. We add the wait () secs block.
10. For the empty slot, we pick the random numbers 1 and 5 . These values give good
11. We also change the height to a random number between -170 and -130 .
12. Also, we switch to a random costume, numbered 1 to 6 .
13. After all these randomized choices are made, we can create our clone by using the
create a clone of <myself> block.
Search WWH ::

Custom Search