Re: Detect individual Collisions

2004-03-03 Thread Geoff Canyon
I'd change the script slightly. First, I'd use the mouseMove handler 
exclusively to avoid the mouseStillDown overhead. Second, I'd store the 
color of the graphic in a script local and only change it if necessary. 
Third (minor) I'd switch the test for the if to test if i is the number 
of the moving graphic first -- Revolution's if tests will fail out at 
the first false statement, so test the easy thing (number vs. number) 
first, and then do the intersection.

local sMoving,sMyColor

on mouseDown
  put true into sMoving
  put the textColor of me into sMyColor
end mouseDown
on mouseUp
  put false into sMoving
end mouseUp
on mouseRelease
  put false into sMoving
end mouseRelease
on mousemove
  if not sMoving then exit mouseMove
  put "red" into tColor
  put the number of me into tMyNumber
  repeat with i = 1 to the number of graphics
if i is not tMyNumber and intersect (me, graphic (i)) then
  put "green" into tColor
  exit repeat
end if
  end repeat
  if tColor is not sMyColor then
set the textcolor of me to tColor
put tColor into sMyColor
  end if
end mousemove
regards,

Geoff Canyon
[EMAIL PROTECTED]
On Mar 2, 2004, at 2:14 AM, Alain Bois wrote:

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
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Detect individual Collisions

2004-03-02 Thread Alain Bois
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
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Detect individual Collisions

2004-02-29 Thread jbv
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
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


Detect individual Collisions

2004-02-29 Thread Jan Sælid
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
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution