"N. Taylor" wrote:
> 
> To the list:
> 
> I cannot call sprite by their number but instead need to check collisions by
> castNumber.

This is a major problem. You need to restructure your project. Members
can't intersect each other, only their sprite-instances can intersect.
Maybe you can put sprites in channels that match their castnumbers.


> This is the loop I've created, but it's not working.  Any advice?

You've got some confusions here...

> i = sprite(mySprite.castNum)

You're setting i to the sprite that's in the channel that has the same
number as the cast number of mySprite... are you sure you want to do this?
Setting i to a sprite isn't something you want to do anyway, you need to
set it to a number, but...

> for i = 6 to 8

it doesn't matter much because you're trying to loop with i set to 6,7
and 8, overwriting the value for i from the first line. except that this
line is not proper Lingo, Try

repeat with i = 6 to 8

> ...
> if sprite(i).memberNum = 8 then
> kill me
> end if

As far as I know 'kill' isn't a lingo command (D7) and even if it were,
trying to 'kill' an object from within itself is a recipe for disaster.

Assuming the code you posted _would_ work, you'd have to finish the if
statements and the repeat  statement. 
Take advantage of the lingo compiler and let it tell you where your
major syntactic mistakes are.

> i = sprite(mySprite.castNum)
> for i = 6 to 8
> if sprite(mySprite).intersects(i) then
> if sprite(i).memberNum = 7 then
> sprite(mySprite).width = sprite(mySprite).width * 1.1
> sprite(mySprite).height = sprite(mySprite).height * 1.1
> end if
> if sprite(i).memberNum = 8 then
> kill me
> end if

something like this (non functional code):

repeat with i = 6 to 8
  if sprite(mySprite).intersects(i) then
    if sprite(i).memberNum = 7 then
      sprite(mySprite).width = sprite(mySprite).width * 1.1
      sprite(mySprite).height = sprite(mySprite).height * 1.1
    end if
    if sprite(i).memberNum = 8 then
      kill me
    end if 
  end if
end repeat

You're used to coding in some other language aren't you? You need to
spend some more time with the Lingo books and tutorials.

-- 
Carl West    [EMAIL PROTECTED]
617.262.8830 x246    

I have no superfluous leisure; my stay must be
stolen out of other affairs; but I will attend you awhile.

           - Isabella, Measure for Measure, Act 3 Scene 1

[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!]

Reply via email to