Irregular shaped buttons redux
Scott Rossi
scott at tactilemedia.com
Fri Nov 19 15:09:41 EST 2004
Recently, Judy Perry wrote:
> Sorry to be so dense here, but I'm not seeing how to use the within()
> function.
>
> I suppose I could set *either* image as the object, but the loc of both
> are constantly changing, and how do I check for within() four sets of
> points?
Without knowing what you're doing, this might work:
# CHECK FOR COLLISION BETWEEN BOX1 AND BOX2
function collisionCheck obj1,obj2
set itemDel to "|"
put "0|0|0|0" into tPointSet
put the topLeft of img obj1 into item 1 of tPointSet
put the topRight of img obj1 into item 2 of tPointSet
put the bottomLeft of img obj1 into item 3 of tPointSet
put the bottomRight of img obj1 into item 4 of tPointSet
repeat with N = 1 to 4
if within(img obj2,item N of tSet) then return true
end repeat
return false
end collisionCheck
Regards,
Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com
More information about the use-livecode
mailing list