Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Simple projectile with gravity
Timehouse Speech Xtra
UltimateNet Xtra
FileXtra
Play Backward Until Marker and Jump
File Read/Write
Components XObject
Create a Shortcut on desktop
Field Slinky
MUSTARD
 

 

 

Behavior Random Sprite Swap

Added on 7/1/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

This item has not yet been rated

Author: ColeTierney

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

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail