Game Development Reference
In-Depth Information
5. We add a fixed repeat () loop to repeat the patern, which is shown in the
screenshot number 8, four imes.
6. Inside this loop are four more repeat loops that describe each part of the
complete patern.
7. With the first one, we repeat 20 imes (using repeat ) to move speed steps .
This moves the sprite in a straight line towards the botom-let.
8. Then we start turning around in a circle. We use repeat () / turnStep imes
with value 270 .
9. At each step, we make the sprite turn clockwise using turn <clockwise>
turnStep degrees .
10. We also use move speed steps to move the sprite in a circle, instead of around
its own center point.
11. After this, it's back to a straight line. We can duplicate the earlier script component
for this (using duplicate ) as it works in exactly the same way. Since the sprite has
rotated, it will now move in the botom-right direcion.
12. Finally, we make another turn. This is very similar to the first turn, so we can also
use duplicate to make a copy of this script.
13. In this case, we have the sprite move counterclockwise. So, we replace the turn
<clockwise> block with the turn <counterclockwise> block. That finishes a complete
figure-8 move.
Search WWH ::

Custom Search