From Test-Scratch-Wiki
(Redirected from Eng:Mouse)
The mouse-pointer is an icon showing the location of the computer mouse. In Scratch, the mouse-pointer can sometimes act as a sprite, as it can sense touch and has position values.
As a Sprite
The mouse-pointer is available as an option in some sprite-chooser arguments, such as Go to (), Point Towards (), Touching ()?, and Distance to (). It is counted as a sprite in these cases because it has a position on the Stage, and can be sensed.
Position
Being an object on the screen, the mouse has a position on the coordinate system.
Readout
On the right, directly beneath the Stage, is the mouse position readout. It shows the X and Y positions of the mouse-pointer. Unlike sprites, these positions can be off of the coordinates of the stage.
Blocks
There are also blocks to access the position of the mouse: Mouse X and Mouse Y. These are accompanied with the Mouse X and Mouse Y values.
Clicking
Scratch also has two blocks to sense when the mouse is pressed down: the Hat Block, When I am Clicked, and the Boolean Block, Mouse Down?. Each functions in the normal manner of blocks of its type.
Changing the Cursor
To change the cursor, open a Squeak Workspace and use the following code:
Cursor (name) showWhile:(some-action)
For example:
Cursor crossHair showWhile:[Sensor waitButton]
The cursors available are:
- Normal
- Square
- None
- Working
- Read
- Write
- Execute
- Crosshair
- Eyedropper
- Fill
- Marker
- Stamp
- Right arrow
- Down arrow
- Up arrow
- Move
- Question mark
- Menu
- Hand
- Fist
- Origin
- Corner
- Resize diag
- Resize horiz
The Scratch Modifications Bingo and Insanity have blocks to change the cursor.