From Test-Scratch-Wiki

< Eng:Video Tutorials‎ | Transcriptions

Revision as of 13:21, 13 June 2016 by InterwikiBot (talk | contribs) (Uploading Page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Translate: - English 

Make Your Sprite Follow the Mouse is a video in a series of video tutorials under the Help tab on the Scratch main head bar. It describes how to make a sprite follow the mouse, hence the name. The video is 1 minute and 31 seconds long.


[0:00] In this video, we will make the sprite follow our computer's mouse pointer.

[0:10] Let's get started!

[0:12] To begin with, I will grab the point towards block.

[0:24] Here, I will select "mouse-pointer" from the drop down. This block makes the sprite point in the direction of the mouse.

[0:32] Now, I don't just want the sprite to point at the mouse, I also want it to move towards the mouse pointer, so I will grab the move block, and here I will change the value of the number of steps to 4. You can play around with different numbers here.

[0:47] Also, since I want the sprite to follow the mouse continuously, I will grab the forever block and put it around the first two blocks.

[0:56] Finally, I want this program to run after I've clicked on the green flag, so I will grab that block from under the Controls link.

when gf clicked
    point towards [mouse-pointer v]
    move (4) steps

[1:03] Now, when I click on the green flag, the sprite will start following my mouse pointer.

[1:13] To make the sprite stop, hit the stop button.

[1:16] Here's a question for you. Instead of moving towards the mouse, could you make the sprite move away from the mouse pointer?

[1:24] (Pop up window) Hint: The "If on edge, bounce" block located under the Motion link in the blocks palette could be useful

See Also