home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / ScriptX / Draggable ScriptX Folders / utils / DTK / Examples / Custom Classes / chngsprt.cls < prev    next >
Encoding:
Text File  |  1995-10-27  |  1.1 KB  |  56 lines  |  [TEXT/ttxt]

  1. format debug "--  Compiling ChangeSpriteAction Class . . .\n" undefined undefined
  2.  
  3.  
  4. class ChangeSpriteAction (Action)
  5.  
  6.     instance variables
  7.         target
  8.         location
  9.         inks
  10. end
  11.  
  12. method init self {class ChangeSpriteAction} #rest args #key target:(undefined) location: inks:->
  13. (    
  14.     apply nextMethod self args
  15.     
  16.     self.target := target
  17.     self.location := location
  18.     self.inks := inks
  19.     
  20. )
  21.  
  22. method trigger self {class ChangeSpriteAction} theTarget thePlayer ->
  23. (    
  24.     -- self.target should be a presenter
  25.     -- Copy over all the interesting aspects
  26.     
  27.     local newTarget := self.target
  28.     
  29.     theTarget.boundary := newTarget.boundary
  30. --    if isAKindOf theTarget TextSprite do
  31. --    (
  32. --        theTarget.boundary := newTarget.boundary
  33. --    )
  34.     
  35.     -- Assign other IVs
  36.     theTarget.fill := newTarget.fill
  37.     theTarget.stroke := newTarget.stroke
  38.  
  39.     local obj := self.inks[@matte]
  40.     local sten := theTarget.boundary
  41.     if (sten.matteColor <> obj) do
  42.     (
  43.         sten.matteColor :=  obj
  44.     )
  45.  
  46.     obj := self.inks[@invisible]
  47.     if (sten.invisibleColor <> obj) do
  48.     (
  49.         sten.invisibleColor := obj
  50.     )
  51.     
  52.     theTarget.position := self.location
  53. )
  54.  
  55. #(ChangeSpriteAction,#(),#())
  56.