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
SceneList
Mac Disk
Behavior Documentor
27 Sum Game-Score Field
JTMR Yo Style Writer
Centipede
Paste Behavior (Ctrl + V)
MUI Maker
Circular Rollover behavior
Back Button
 

 

 

Behavior Drop Shadow Follow Mouse or Sprite-Alphamania

Added on 6/10/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

Required Xtras:
Alphamania
Effector Set II for Alphamania

This item has not yet been rated

Author: MediaLab (website)

Requires Effector Set 2

property sNum
property mode -- static, follow sprite, follow mouse
property lightSprite -- which sprite to follow
property transparency
property red, green, blue
property feather
property offsetX, offsetY

on getBehaviorDescription me
  return "Add a drop shadow to your sprite that will follow the mouse or another sprite."
end

on getPropertyDescriptionList me
  set list = [:]
  addProp list, #mode, [#comment: "Relative To:", #format: #symbol, #range: [#Sprite, #Mouse], #default: #Mouse]
  addProp list, #lightSprite, [#comment: "Sprite To Follow (if relevant):", #format: #integer, #default: 1]
  addProp list, #transparency, [#comment: "Transparency:", #format: #integer, #default: 200, #range: [#max: 255, #min:0]]
  addProp list, #red, [#comment: "Red:", #format: #integer, #default: 0, #range: [#max: 255, #min:0]]
  addProp list, #green, [#comment: "Green:", #format: #integer, #default: 0, #range: [#max: 255, #min:0]]
  addProp list, #blue, [#comment: "Blue:", #format: #integer, #default: 0, #range: [#max: 255, #min:0]]
  addProp list, #feather, [#comment: "Feather:", #format: #integer, #default: 0, #range: [#max: 4, #min:0]]
  addProp list, #offsetX, [#comment: "Offset X:", #format: #integer, #default: 4]
  addProp list, #offsetY, [#comment: "Offset Y:", #format: #integer, #default: 4]
  return list
end

-- apply the drop shadow effect
on beginSprite me
  set sNum = the spriteNum of me
  set animMode = #relativeToPoint
  dropShadow(sprite sNum, [#animMode: animMode, #transparency: transparency, #red: red, #green: green, #blue: blue, #feather: feather, #xOffSet: offsetX, #yOffSet: offsetY])
  Add(the actorList, me)
end

on endSprite me
  set pos =   getone(the actorList, me)
  if pos then
    deleteAt(the actorList, pos)
  end if
end

on StopEffect me, sym
  -- removes this behavior from the actorList
  if not voidP(sym) then
    if sym <> #dropShadow then exit
  end if
  set pos =   getone(the actorList, me)
  if pos then
    deleteAt(the actorList, pos)
  end if
end

on ResumeEffect me, sym
  -- adds this behavior to the actorList
  if not voidP(sym) then
    if sym <> #dropShadow then exit
  end if
  set pos =   getone(the actorList, me)
  if pos = 0 then
    Add(the actorList, me)
  end if
end



-- new light settings if needed
on setShadow me
  if mode = #Mouse then
    set x = the mouseH
    set y = the mouseV
  else if mode = #Sprite then
    -- IF YOU GET A SCRIPT ERROR HERE, YOU HAVE PROBABLY SPECIFIED
    -- AN INVALID SPRITE FOR THIS BEHAVIOR
    set x = the locH of sprite lightSprite
    set y = the locV of sprite lightSprite
  end if
  dropShadow(sprite sNum, [#lightLocX: x, #lightLocY: y])
end

on stepFrame me
  setShadow(me)
end

 


Contact

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

Send e-mail