about collision routines.

jbv jbv.silences at Club-Internet.fr
Thu Mar 18 10:13:01 EST 2004


use the intersect() fonction.
When used in a carefully built repeat loop, it runs
at acceptable speed, even on slow cpu.
By "carefully built repeat loop" I mean : if for example
you have 15 objects on the screen, you don't need to
test if each one intersects with each other one : once you
have tested if obj 1 intersects with obj 2, then you don't
need to test if obj 2 intersects with obj 1.
Therefore the loops should be built as follows :

repeat with j=1 to (number of objects) - 1
   repeat with i=j+1 to number of objects
      if obj i intersects with obj j then
         do something
      end repeat
   end repeat
end repeat

note : this is not valid Transcript syntax, just a
demonstration of the approach...

JB


> Hi Folks,
>
> I am planning a simple arcade game in Rev. I inspected all those
> marvelous stack by Mr Scott Rossi of Tactile Media and gathered almost
> all the theory I need. My only doubt is about collision. Did anyone
> here got a nice collision routine for two objects? My routine is slow,
> when applied to a array of objects it lags the answer.
>
> Cheers
> Andre
> --
> Andre Alves Garzia - Soap Dog Studios - BRAZIL
> http://studios.soapdog.org
>
> _______________________________________________
> 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