m (The Method: Changed "way" to "method", sounds less colloquial)
Line 4: Line 4:
 
There are many different ways of using it, but this tutorial will mention two.  
 
There are many different ways of using it, but this tutorial will mention two.  
  
===First Way===
+
===First Method===
 
This script will cause the the sprite to change to a different 'highlighted' costume when touching the mouse. Nice and simple and good for menu buttons.
 
This script will cause the the sprite to change to a different 'highlighted' costume when touching the mouse. Nice and simple and good for menu buttons.
  
Line 18: Line 18:
 
</scratchblocks>
 
</scratchblocks>
  
===Second Way===
+
===Second Method===
 
This script uses a different concept, it shall not change costume but in fact use [[Graphic Effect|graphical effects]] (in this case the [[Graphic Effect#Color|color effect]]) to change its appearance, while touching the mouse-pointer, before reverting to its usual look.  
 
This script uses a different concept, it shall not change costume but in fact use [[Graphic Effect|graphical effects]] (in this case the [[Graphic Effect#Color|color effect]]) to change its appearance, while touching the mouse-pointer, before reverting to its usual look.  
  

Revision as of 01:33, 13 May 2012

The Mouse-Over Script is a very simple script, which enables the Scratcher to change a sprite's appearance or function, simply by moving the mouse over a trigger area or sprite. This is most commonly used for aesthetic appeal, however this method can be applied to multiple scenarios.

The Method

There are many different ways of using it, but this tutorial will mention two.

First Method

This script will cause the the sprite to change to a different 'highlighted' costume when touching the mouse. Nice and simple and good for menu buttons.

when flag clicked
forever
if <touching [mouse-pointer v]?>
switch to costume [costume2 v]
else
switch to costume [costume1 v]
end
end

Second Method

This script uses a different concept, it shall not change costume but in fact use graphical effects (in this case the color effect) to change its appearance, while touching the mouse-pointer, before reverting to its usual look.

Of course any effect one wishes to use can take place using this script, these are only examples.

when flag clicked
forever
if <touching [mouse-pointer v]?>
set [color v] effect to (25)
else
set [color v] effect to (0)
end
end

Uses

This script has many different uses, however these are a few:

  • Improving the aesthetics (how good something looks) of a project
  • Letting a user know that an object can be clicked
  • Making a project seem more professional
  • Recreating menus that a user has seen in a video game