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

Reply via email to