Is it possible to test if the mouse is overlapping an object directly from LUA script?
Printable View
Is it possible to test if the mouse is overlapping an object directly from LUA script?
Apparently not, an OverlapsPoint member would be neat, like Collisionmask.TestPoint
I guess you'll have to use a 1x1 px object for that.
yeh thats what I am doing currently but it would have been better if I could test directly from the mouse instead.
Wonder if Retreiver2 would add it someday?
I'll guess he'll see this thread, and I don't see any problem in adding a OverlapsPoint member, though I'm not sure how he would implement it anyway.
well if other overlap checks are possible im sure a point check could be too. Anyway thanks for the reply Looki, I will stick to this way for the moment
So far I've been unsuccessful trying to leverage the testpoint functions for sprites (all this stuff is intentionally undocumented, heh). But maybe after all the experience I had with the Active Shape object, I might have some new insight into it. I'll have another look.
OK that would be great.
Just FYI I succeeded in getting it to work .. just have a little refactoring to do before I put up a new build.
Wow you are awesome! Look forward to testing it out!
http://hocuspocus.taloncrossing.com/rii/xlua-dist.zip
All existing collision detection routines are now deprecated and aliased to functions that are part of a new suite of cd functions. It's all been rewritten from scratch and should be more reliable (and eliminate some corner case crashes).
The specific function to "solve" this thread is now mmf.Collisions.ObjectTestPoint(objid, x, y)
Here's a quick reference of the new set of collision detection functions, which are grouped and named for consistency. Check the reference for more info.
- mmf.Collisions.BackdropTestPoint (x, y, [layer])
- mmf.Collisions.BackdropTestRect (x, y, w, h, [layer])
- mmf.Collisions.BackdropTestObject (objid, [layer], [xoff], [yoff])
- mmf.Collisions.ObjectTestPoint (objid, x, y, [layer])
- mmf.Collisions.ObjectTestRect (objid, x, y, w, h, [layer])
- mmf.Collisions.ObjectTestObject (objid, objid, [layer], [xoff], [yoff])
- mmf.Collisions.ObjectClassTestPoint (classid, x, y, [layer])
- mmf.Collisions.ObjectClassTestRect (classid, x, y, w, h, [layer])
- mmf.Collisions.ObjectClassTestObject (classid, objid, [layer], [xoff], [yoff])
- mmf.Collisions.GetObjectsOverPoint (x, y, [classid], [layer])
- mmf.Collisions.GetObjectsOverRect (x, y, w, h, [classid], [layer])
- mmf.Collisions.GetObjectsOverObject (objid, [classid], [layer], [xoff], [yoff])