On 1/31/01 12:36 AM, Fabricio G. Bissoli ([EMAIL PROTECTED]) sent:
>spriteAna= spriteNum
>set listaSpritesMovidos2=[:]
>repeat with i=160 to 264
> if (sprite(i).intersects(spriteAna)) and
findPos(listaSpritesMovidos2,i)=void) then
> listaSpritesMovidos2.addProp(i,(sprite(i).loc))
> spriteAna=i
> i=160
> end if
>end repeat
Fabricio,
I'm not sure exactly what you want, but I think the script has some
problems.
First, there is an unbalanced paranthesis in the if statement after the
void.
Second, you can avoid the findPos = void step by using setaProp instead
of addProp.
Third, there there are problems in the loop logic. What this script does
is:
1) check if the first i (160) intersects with spriteNum (you didn't say
what that value is)
2) (if intersection) reassign spriteAna to i (160)
3) (if intersection) reassign i to 160 again
then
1) check if the first i (160 again due to reassignment) intersects with
last i (160)
2) (if intersection) reassign spriteAna to i (160)
3) (if intersection) reassign i to 160 again
The reassignments are not good. In fact, the only reason this isn't an
infinite loop is that if there is no intersection, the i is not
reassigned.
Try this:
on exitFrame me
listaSpritesMovidos2=[:]
--listaSpritesMovidos2.sort()
repeat with spriteAna = 160 to 264
repeat with i=160 to 264
if sprite(i).intersects(spriteAna) AND i <> spriteAna then
listaSpritesMovidos2.setaProp(i,(sprite(i).loc))
end if
end repeat
end repeat
end
This checks if each sprite intersects with any other sprite in the
range--except itself, obviously. I sorted the list just to test the
results, but you may not want that so I commented that line. I hope
that's what you want.
Rich Shupe
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]