As this block checks if the mouse is being clicked, it is useful for simulating clicks anywhere, even on the scripting area (not perfectly, however) and especially with one sprite one script projects; if the project requires clicking, this block can be used to serve as a replacement for the When () Clicked block, as the Hat block cannot be used in the middle of a script.
Some common uses for the Mouse Down? block:
- Sensing when an object should be lifted with the Not () block (when the mouse is not held anymore)
forever if <mouse down?> then wait until <not <mouse down?>> repeat until <mouse down?> go to [mouse-pointer v] end wait until <not <mouse down?>>
- Sensing with draggable objects
- Recording mouse clicks
when gf clicked reset timer forever if <mouse down?> then set [down v] to (timer) wait until <not <mouse down?>> set [up v] to (timer) set [elapsed v] to ((up) - (down)) add (down) to [mouse-downs v] add (up) to [mouse-ups v] add (elapsed) to [down times v]
In some Scratch modifications, there are similar blocks which allow the user to detect other mouse buttons; either the right-click or left-click button.