Game Development Community

OnMouseOver?

by Backman · in Torque Game Builder · 12/05/2008 (1:33 pm) · 2 replies

Is there a function that would get called when the mouse moves over an item? Just cant seem to figure it out..

#1
12/05/2008 (2:03 pm)
A scene object? Yes.

function MyObjectClass::onAddToScene(%this)
{
    // The scene window must allow scene objects to use mouse events
    sceneWindow2d.setUseObjectMouseEvents(true);
    
    // The scene object must be flagged to use them too!
    %this.setUseMouseEvents(true);
}
 
funtion MyObjectClass::onMouseEnter(%this, %modifier, %worldPosition, %clicks)
{
    // Do stuff
}
For an explanation of what each of the parameters mean, check out the t2dSceneObject documentation.
#2
12/06/2008 (6:17 am)
Thanks for the quick help, got totally stuck on that one although hunting through the docs.. Excellent!