m (First Method: eliminated "bump" at the end of the forever block.)
m (The Method)
Line 29: Line 29:
 
else
 
else
 
set [color v] effect to (0)
 
set [color v] effect to (0)
end
 
 
end
 
end
 
</scratchblocks>
 
</scratchblocks>

Revision as of 12:29, 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

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

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