[Squeakland] Making an object follow the mouse (was: Lack of documentation frustrating)

Scott Wallace scott.wallace at squeakland.org
Tue Oct 31 22:53:05 PST 2006


Hi, Guyrren, and all,

> For example: I wanted to make an etoy follow the mouse pointer
> around. I can't see any way of even obtaining a reference to a mouse
> object.

Bring up the "world's" halo, by alt-clicking on the squeak desktop,  
and then click on its turquoise handle to bring up the world's Viewer.

If you type "mouse" into the search pane of that Viewer, you'll find  
that there are tiles available for mouseX and mouseY.  These are  
numeric-valued tiles that always report the current x and y  
coordinates of the mouse, in the World's own cartesian coordinate  
system.

Using these, the following script will make an object always follow  
the mouse:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.tiff
Type: image/tiff
Size: 68546 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20061031/d68cd557/pastedGraphic-0001.tiff
-------------- next part --------------


Cheers,

  -- Scott


More information about the Squeakland mailing list