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)
when gf clicked forever wait until <mouse down?> wait until <not <mouse down?>> repeat until <mouse down?> go to [mouse-pointer v] 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]
- Detecting if the mouse is touching and clicking the sprite
when gf clicked if <<mouse down?> and <touching [mouse-pointer v]?>> then say [You're clicking me!] wait until <not <<mouse down?> and <touching [mouse-pointer v]?>> say [You released the mouse!]
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.