Game Development Reference
In-Depth Information
Next, add a show block. Yes, the sprite is already visible now, but at the end of the
script we will make it disappear. This block makes sure it appears again in ime when
the script runs.
We are going to make ive target clones. We will let the target sprite step right ive imes
and create a clone of itself at each step.
1. Atach a repeat () block and fill in 5 .
2. Inside the repeat () block place a move () steps block.
3. Instead of a fixed number, use a pick random 20 to 80 block to make the spots
where a target will appear a litle unpredictable and more interesing.
4. Then, atach the new create clone of () block underneath the move command
inside the repeat block. Select myself .
Finally, use the hide opion on the original sprite. Place this block at the end,
outside the loop.
So now we have a cannon, a cannonball, a bunch of randomly created targets, but sill
no exciing game. The cannonball can ly through the air, but it doesn't do anything
when hiing a target; it just passes right through. This can be easily ixed.
We'll coninue scriping the target irst. Ater a clone is created, you can start running
a script on the clone. This is a new way of iniiaing a script.
1. Start a new script in the target object with a when I start as a clone block.
2. Atach a wait unil () block. This will pause the script unil something happens.
Place a touching ()? condiion block inside the slot. Select cannonball .
Search WWH ::

Custom Search