In this add-on,
you'll make the sprite follow the mouse pointer
and leave dancing clones of itself when the user clicks.
There is a lot going on in this add-on,
and it seems like a big problem to solve, but that's okay!
Computer scientists tackle huge problems
by breaking them down into small pieces
and solving those parts one by one.
You can do the same thing by breaking down
the problem of cloning your dancer into pieces.
First, the sprite needs to follow the mouse pointer.
Then, the sprite needs to clone itself when the user clicks.
Finally, the clone needs to start dancing.
These three pieces are smaller problems
that you can solve separately.
To make the sprite follow the mouse pointer,
open the Motion menu and add a go to mouse pointer block
to your forever block.
Test your code, great!
The sprite now follows the mouse pointer.
The next piece of the problem
is to make the sprite clone itself when clicked.
To do this, go to the Events menu
and add a when this sprite clicked block,
then go to the Control menu
and attach a create clone of myself block
to the when this sprite clicked block.
Now this block stack reads,
when this sprite clicked, create a clone of myself.
Test this code by clicking the green flag,
then clicking around the Stage.
Great!
Now the sprite follows the mouse
and creates clones of itself.
The last step is to make those clones dance.
To do this, click on Control
and add a when I start as a clone block.
Under this block, add the blocks that make the sprite dance.
These are the same blocks you used
to make your first sprite dance.
Forever, next costume, and wait.
Test your code.
Nice!
The sprite follows the mouse pointer
and leaves dancing clones.
This big problem was solved
by breaking it down into three small pieces
and tackling each one separately.
Now you are thinking like a computer scientist.
Now it's your turn.
Make the sprite follow the mouse pointer.
Make the sprite clone itself when clicked.
And finally, make the clones dance.