Game Development Reference
In-Depth Information
Now we are ready to start moving those clones using the following steps:
1. Create a second script staring with a when I start as a clone block.
2. Let's first enable show to make the cloned sprites visible.
3. The clones' movements will repeat unil it touches the edge as seen in the
repeat unil touching <edge> ? block.
4. The clone will move 5 steps each cycle (using the move 5 steps block).
5. When the touching condiion is met, we will delete this clone by using the
delete this clone block.
Test the game and you will discover that there is a problem. The clones won't show up or
even if it does, only briefly. What is happening? Why are they disappearing so quickly? The
answer is easy. We just instructed the clones to delete themselves when they are touching
an edge. The clones start their life on the right edge of the stage, so they are immediately
deleted ater creaion.
We can fix this problem by adding another loop to the script as shown in the following steps:
1.
Before the repeat unil () block, place a repeat () block; enter the value 10 .
2.
Inside the block, place a move () steps block; enter the value 5 .
This will ensure that the clones will first move 10 x 5 = 50 steps. This gives them enough
room to clear the right edge before staring to check for collision with the edge.
 
Search WWH ::




Custom Search