|
|
|
Random Sprite Swap
Added on 7/1/1999
|
A behavior that allows sprites to randomly swap positions.
-- Randomize Positions Behavior --
-- CBT; 5/13/98
--
-- Usage:
--
-- set spriteLocs = []
-- sendAllSprites( #registerCardPositions, spriteLocs )
-- sendAllSprites( #takeRandomCardPosition, spriteLocs )
--
------------------------------------
property spriteNum
on registerCardPositions me, positions
add positions, the loc of sprite spriteNum
end
on takeRandomCardPosition me, positions
set pCount = count( positions )
set myPos = random( pCount )
set the loc of sprite spriteNum = getAt( positions, myPos )
deleteAt( positions, myPos )
end
on getBehaviorDescription
return "Allows sprite to randomly change positions with other sprites."
end
|
|