> I've got a problem with a script.

I agree

> on collisionSprite me
>   if me.spriteNum("bee shape").intersects sprite.("spider shape")THEN
>     sprite.("spider shape").width * 1.1
>     sprite.("spider shape").height * 1.1
>     sprite.("bee shape").width * 0
>     sprite.("bee shape").height  * 0
> end

> The error I'm getting is: "Script error: Expected THEN".

wooooo. I'm surprised that is all you are getting

> Also, I'd prefer to have this part of the script actually
<SNIP>

1 - you should really read the documentation on what Sprite as a Lingo
keyword actually means. the following is directly from the online HELP:

        Syntax  sprite(whichSprite).property

        the property of sprite whichSprite

        Description     Keyword; tells Lingo that the value specified by whichSprite
        is a sprite channel number. It is used with every sprite property.

        A sprite is an occurrence of a cast member in a sprite channel of the
Score.

        Example This statement sets the variable named horizontal to the locH of
sprite 1:

        horizontal = sprite(1).loc

        Example This statement displays the current member
                in sprite channel 100 in the Message window:

        put sprite (100).member


the thing to note here is that the parameter whichSprite is a NUMBER which
refers to the channel that the sprite is placed in. "bee shape" is
meaningless in this context. I assume that it is a member name, but in this
case it is clearly not a sprite. if we were to make the variable
whichSpriteNumber equal to the sprite in channel 10 and if you want to refer
to the member that is used to make a sprite you do it thus

  whichSpriteNumber = 10  -- channel 10
  sprite(whichSpriteNumber).member

and if you actually do want to set that sprite's height & width you do it
like

  whichSpriteNumber = 10
  sprite(whichSpriteNumber).width = 0
  sprite(whichSpriteNumber).height = 0

and if you want to move it off screen, which is what I assume you desire,
you would write

  sprite(whichSpriteNumber).locV = 1000

locV is the vertical location of the given sprite. this would then, move the
sprite to a position 1000 pixels from the top of the screen.

additionally your syntax in the handler you are writing is very incorrect.
for starters you left off the "end if" for your if...then statement. here is
an example from the online Help again

    if (the commandDown) and (the key = "q") then
                cleanUp
                quit
        end if

note the "end if" closure. adding this into your handler & fixing the other
problems you might come up with

on collisionSprite me
 property SpriteNum  -- built in property getting the sprite number of the
                     -- sprite we are attached to

 property spiderSpriteNumber  -- you have to put this in

 beeSpriteNum = spriteNum  -- we dropped this behavior onto the bee sprite

 spiderSpriteNumber = 10  -- you edit this number appropriately

  if sprite(beeSpriteNum ).intersects sprite.(spiderSprite)THEN
    sprite.(beeSpriteNum ).LocV = 1000  -- move the bee sprite ofscreen
    sprite.(spiderSpriteNumber).LocV = 1000  -- move the spider sprite
ofscreen
  end if

end

put this in a behavior script & drop it onto the bee sprite. you would have
to edit the spiderSprite number to the appropriate number.

what you are trying to do is not the most simple thing. I strongly urge you
to read the manual and look at some sample programs. perhaps go to the
www.mediamacros.com site & download some code samples. based on the code you
posted, you need to spend some time getting the fundamentals own. be sure to
also read about behaviors.

HTH

Al Hospers
CamberSoft, Inc.
al<at>cambersoft<dot>com
http://www.cambersoft.com

A famous linguist once said:
"There is no language wherein a double
positive can form a negative."

YEAH, RIGHT






[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