home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Broderbund Demo / DemoData / JGM / JMDEMOB.Dxr / 00409_randomEventMan.ls < prev    next >
Encoding:
Text File  |  1997-08-22  |  1.1 KB  |  57 lines

  1. property myObjects
  2.  
  3. on new me
  4.   set myObjects to [:]
  5.   return me
  6. end
  7.  
  8. on turnOn me
  9.   if myObjects = EMPTY then
  10.     exit
  11.   end if
  12.   repeat with r in myObjects
  13.     tell r
  14.       activate(r)
  15.     end tell
  16.   end repeat
  17. end
  18.  
  19. on turnOff me
  20.   if myObjects = EMPTY then
  21.     exit
  22.   end if
  23.   repeat with r in myObjects
  24.     tell r
  25.       deActivate(r)
  26.     end tell
  27.   end repeat
  28. end
  29.  
  30. on addSprite me, theName, theSprite, theMember, theLength, theInterval
  31.   set newObject to new(script "randomSpriteMan", theSprite, theMember, theLength, theInterval)
  32.   setaProp(myObjects, theName, newObject)
  33. end
  34.  
  35. on addSound me, theName, theChannel, theSound, theInterval
  36.   set newObject to new(script "randomSoundMan", theChannel, theSound, theInterval)
  37.   setaProp(myObjects, theName, newObject)
  38. end
  39.  
  40. on killObject me, theName
  41.   if getaProp(myObject, theName) > 0 then
  42.     deActivate(getaProp(myObjects, theName))
  43.     deleteProp(myObjects, theName)
  44.   end if
  45. end
  46.  
  47. on stepObject me
  48.   if myObjects = EMPTY then
  49.     exit
  50.   end if
  51.   repeat with r in myObjects
  52.     tell r
  53.       stepObject(r)
  54.     end tell
  55.   end repeat
  56. end
  57.