Please update your browser
Your browser version is not supported by this site. CS First may not work properly. Learn more.
In this video you will program the player sprite
to follow the mouse pointer.
To start, select the players sprite.
Next, click the motion menu
and drag out a go to mouse pointer block.
When you click it
the sprite will go towards the mouse pointers location.
The sprite needs to follow the mouse.
That means that the sprite needs to go to the mouse pointer
over and over again.
Not just once.
To do that, use the forever block.
Now when you click on this block stack
the sprite will go to the mouse every time.
Next, add an event to tell the computer
when to run this code.
Use a when sprite clicked event
which tells the sprite to follow the mouse pointer
when the sprite is clicked.
Finally, try it out to see if it works.
Click the sprite.
Don't click and drag the sprite,
but instead click and release it.
To stop the program click the stop sign.
Now it's your turn.
Program your player sprite using:
a go to mouse pointer block,
a forever block,
and a when this sprite clicked event.