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
Toast
SerialXtra
Photo Caster
Moving tool tip
Go to net page button/frame
Select Button With Rollover Effect
Play/ Pause/ Stop/ Rewind a Flash Sprite
Delete a file
Drop-Down Boxes in Director
FreeRotate
 

 

 

Behavior sprite movement according to mouseV

Added on 7/21/1999

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: StanleyWidjaja

makes a sprite (s) moves up or down and constrained horisontally to invisible line/sprite

property constrainstsprite
property stageWidth
property stageMiddle
property Speed
property Speedincrement




on beginsprite me
  set Speedincrement                     = Speed
  set stageWidth                         = the stagebottom- the stagetop
  set stageMiddle                        = stageWidth/2
  set the constraint of sprite(me.spriteNum)=(me.constrainstsprite)
end beginsprite

on enterframe me  
  if the mouseV <  stageMiddle then
    set  amountToMove= (stageMiddle + the mouseV)/Speedincrement
    set the loch of sprite(me.spriteNum) = the loch of sprite (me.spriteNum) + amountToMove
  end if
  
  if the mouseV > stageMiddle then
    set  amountToMove= (stageMiddle - the mouseV)/Speedincrement
    set the loch of sprite(me.spriteNum)= the loch of sprite(me.spriteNum) + amountToMove
  end if
end enterframe me



on getPropertyDescriptionList
  set p_list = [¬
  #Speed            :   [#comment:"Speed in pixels", #format: #float, #range: [#min: 3, #max: 20], #default:"11"], ¬
  #constrainstsprite:   [#comment:"constrainer Spritenumber", #format: #integer, #default: "15"]]
  return p_list
end getPropertyDescriptionList

 


Contact

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

Send e-mail