Game Development Community

TGB onMouseEnter onMouseLeave problem

by Bruno Campolo · in Technical Issues · 08/09/2010 (11:22 pm) · 0 replies

I implemented the following:

function myObject::onMouseEnter(%this, %modifier, %worldPos)
{
Canvas.setCursor(CrossHairCursor);
}

function myObject::onMouseLeave(%this, %modifier, %worldPos)
{
Canvas.setCursor(DefaultCursor);
}

which works... with one major flaw. The cursor only changes WHEN YOU MOVE THE MOUSE, yet 'myObject' (which is also moving) can move under the mouse and away from the mouse without triggering this event and therefore not changing the cursor.

The funny thing is if I echo anything to the console it will check for this event and trigger it if necessary. I would just hate to have to write garbage to the console every 1/10 of a second to make this work correctly.

Any advice?

About the author

Creator of Bantam City Games, a one-man independent game development studio. To learn more, check out 'A Game Developer's Saga', a game development blog at: http://www.bantamcity.com/blog