Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this add-on,
you will create a spiral movement effect.
Choose a costume to spiral.
This example adds a new costume to the Paint Editor.
Next, program the costume to appear
as part of the Studio Logo.
Follow the same process as in the previous videos
to make a new clone.
Add switch-costume and create-clone blocks.
Duplicate an if statement,
change the value to the number of the new costume,
and delete the code inside.
Next, program the costume to spiral.
A spiral is similar to the movement of a circle,
except that the distance the sprite moves
decreases each time.
Program the sprite to move in a circle
using a repeat loop, a move block,
and a turn-right block.
Show the sprite so that you can test the movement.
Next, create a spiral.
Make a variable and name it spiral.
Drag out a set-spiral block
and place it above the repeat loop.
Change the value in the block to something larger than 30
so that the sprite makes a full circle.
This example uses 40.
If the repeat loop is greater than the value
in the spiral variable, the spiral will reverse.
Drag out a spiral variable
and place it inside the value of the repeat loop.
This makes the sprite go in a circle.
Add another spiral variable inside the move block.
This sets the distance the clone will move each time.
Drag out a change-spiral-by block,
place it in the repeat loop, and make the value -1.
This will decrease the movement each time the loop runs,
making the sprite move in gradually smaller circles.
Test it out by clicking the stack.
The clone should spiral.
Next, make the sprite start and end
in a specific direction.
Use a go-to-xy block to set the starting position.
This example moves the costume to the top left of the stage.
Use a set-rotation-style block
to make the clone turn the way you want it to.
This example uses All Around,
so that the clone completely rotates.
Use the point-in-direction block
to help determine where the sprite will spin first.
This example sets the value to 90 degrees.
Place this block under the repeat loop
to make the sprite end its motion in an upright position.
Test it by clicking the stack.
Continue to tinker with the values
to make the spiral bigger or smaller.
If you can't make the clone end up in the right place,
use a glide block to move it to the correct position.
Place this new code stack inside the new if block.
Test it to make sure everything works.
Now it's your turn.
Create a new costume to clone.
Make a spiral by creating a spiral variable
and using move, turn, change-by, set-to, and repeat blocks.
Use motion blocks to set the starting location,
rotation style, and final destination of the clone.