Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video,
you'll program the accessory sprite
to follow the mouse-pointer,
so the stylist using the program
can control the placement of each accessory.
To start, click the sprite named accessory.
Then, drag out the go to mouse-pointer block
from the motion menu.
Click on the block,
and you'll see that the accessory sprite
moves as close to the mouse-pointer as it can.
When you move the mouse around,
the accessory sprite doesn't follow it.
Well, that's not very helpful.
When clicked, the go to mouse-pointer block
only runs once.
You need the accessory sprite to continuously
go to the mouse-pointer
as the mouse moves around the screen.
Make that happen by dragging out a forever block
from the control menu.
Put the forever block around the
go to mouse-pointer block.
Try it now.
When you move the mouse-pointer around the stage,
the accessory sprite goes to the mouse-pointer
over and over again.
Lastly, add a when flag clicked block to the stack
to make the accessory sprite follow the mouse-pointer
as soon as the project is run.
Now it's your turn.
Add a go to mouse-pointer block.
Add a forever block,
and add a when flag clicked block.
In the next video,
you'll learn how to stamp the accessory.