Detect individual Collisions
Alain Bois
in.bois at wanadoo.fr
Tue Mar 2 05:14:55 EST 2004
There is my solution
I put the following script into a hide field
on mousestilldown
set the loc of me to the mouseloc
end mousestilldown
on mousemove
repeat with i = 1 to the number of graphics
if intersect (me, graphic (i)) and i is not the number of me
then
set the textcolor of me to "green"
exit repeat
else
set the textcolor of me to "red"
end if
end repeat
end mousemove
Call it field 1
and i put this script into the card script or stack script
on newgraphic
set the script of the last graphic to fld 1
end newgraphic
and after when I create a new graphic, when it has a collision with any
object graphic it changes of color.
Le 29 févr. 04, à 12:26, jbv a écrit :
> Use the intersect fonction inside a repeat loop.
> I did something similar last year : the user was drawing
> a selection rectangle on the screen, and various objects
> were changing their bordercolor in real time if they were
> (or weren't) inside the selection rect. I was even able to
> implement multiple selection (using the shift key and
> comparing the current selection with a list of previous
> selected objects).
> Speed wasn't a roblem on a Mac 9600 / 300...
>
> JB
>
>> Hi there
>>
>> I'm trying to make a timeline-bar where you can add or delete
>> rectangles containing "whatever". The user should be able to move a
>> rectangle left or right, but if it collides with another rectangle,
>> it should stop....
>>
>> Because the user is able to delete and add new rectangles I have to
>> make some sort of function check if the moving rectangle is going to
>> collide with other rectangles to the left and right. (like the
>> timeline in Adobe Premiere) I know this is possible, but how do I do
>> it fast..... Checking every rectangle with repeat is to slow.....and
>> the only idea I have now is to make a list in a hidden field-table
>> for every new created rectangle......
>>
>> any ideas....?
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list