And here it is dot syntaxed:
on mouseUp me
ps = [138,178,218,258]
repeat with b = 1 to 4
r = random(ps.count())
sprite(b+4).locV = ps[r]
ps.deleteAt(r)
end repeat
end
:)
----- Original Message -----
From: "Fergus Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 19, 2001 12:30 PM
Subject: Re: <lingo-l> random and the LocV
>
> Here is the same way in fewer lines:
>
> on mouseUp me
> -- **********************************************
> set PosSprite = [138,178,218,258]
> repeat with B = 1 to 4
> r = random(count(PosSprite))
> set the LocV of sprite B + 4 = getAt(PosSprite,r)
> DeleteAt PosSprite, r
> end repeat
> -- **********************************************
> end
>
> Fergus
>
>
> At 09:05 19/10/2001 -0700, you wrote:
> >Perhaps an approach like this:
> >
> >on mouseUp me NumSprite = [5,6,7,8]
> > PosSprite = [138,178,218,258]
> > repeat with B = 1 to 4
> > thisNumSprite = NumSprite[B]
> > nPositions = count(PosSprite)
> > PosSpriteIndex = random(nPositions)
> > thisPosSprite = PosSprite[PosSpriteIndex]
> > deleteAt(PosSprite, PosSpriteIndex) -- eliminate this one from the list
> > -- Finally, do the assignment
> > sprite(thisNumSprite).locV = thisPosSprite
> > end repeat end
> >
> >Irv
> >
> >At 1:02 AM +0200 10/19/01, Jacques Baume wrote:
> >>Hello All !
> >>
> >>I have 4 sprites on a stage.
> >>The first position is 138, the second is 178,the third is 218 and the last
> >>is 258.
> >>I would like by clicking on a button, to change the place of these sprites
> >>with randomize function. I tried the command like this...
> >>
> >>on mouseUp me set the LocV of sprite (4 + random (4)) = 258
> >> -- **********************************************
> >> set NumSprite = [5,6,7,8]
> >> set PosSprite = [138,178,218,258]
> >> repeat with B = 1 to 4
> >> set the LocV of sprite getAt(NumSprite,B) = getAt(PosSprite,random(B))
> >> end repeat -- **********************************************
> >>end
> >
> >--
> >
> >Lingo / Director / Shockwave development for all occasions.
> > (Home-made Lingo cooked up fresh every day just for you.)
> >
> >[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!]
> >
>
>
> [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!]
>
[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!]