Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Vector Shape - Create Square Wave
Sprite controls
Find out which cast members use a given font
MailTo Xtra
Watcher Window Behavior
QWI Script Styler
SpriTec Xtra! - Export your Cast and Score
lingo to php with browser on stage
MIAW Event Leak
Rolling a Ball.
MediaMacros Xtras Mall
 

 

 

Behavior Orbital Master

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: MichaelSeery

Use with orbital slave behavior

property mySprite
property dragging
property mass
property velocity
property location


on exitFrame
  if dragging then
    set the locH of mySprite = the mouseH
    set the locV of mySprite = the mouseV
    set velocity = [ #X:0, #Y:0 ]  
    set location = [ #X: the locH of mySprite, #Y: -the locV of mySprite ]
  end if
end


on push me, netForce
  --Update my velocity:
  set velocity = velocity + netForce / mass
  
  
  --Velocity governor:
  if abs( the X of velocity ) > 10.0 then
    if the X of velocity < 0 then
      set the X of velocity = -10.0
    else
      set the X of velocity = 10.0
    end if
  end if
  
  if abs( the Y of velocity ) > 10.0 then
    if the Y of velocity < 0 then
      set the Y of velocity = -10.0
    else
      set the Y of velocity = 10.0
    end if
  end if
  
  
  --now move:
  set location = location + velocity
  set the locH of mySprite = integer( the X of location )
  set the locV of mySprite = - integer( the Y of location )
end


on mouseDown
  set dragging = TRUE
end


on mouseUp
  set dragging = FALSE
end


on mouseUpOutside
  set dragging = FALSE
end


on registerOrbitalBodies me, theList
  set myData = [ #channel:the spriteNum of me, #object: me ]
  if not getOne ( theList, myData ) then
    add theList, myData
  end if
end


on removeOrbitalBodies me, theList
  set myData = [ #channel:the spriteNum of me, #object: me ]
  repeat while getOne ( theList, myData )
    deleteOne theList, myData
  end repeat
end


on beginSprite me
  set mySprite = sprite ( the spriteNum of me )
  set dragging = FALSE
  
  sendAllSprites( #orbitalBodyReadyToRegister, me )
  
  if mass < 10.0 then
    set mass = 50.0
  end if
  
  set velocity = [ #X:0, #Y:0 ]
  set location = [ #X: the locH of mySprite, #Y: -the locV of mySprite ]
  
  return me
end


on endSprite me
  sendAllSprites( #orbitalBodyReadyToRemove, me )
end


on getBehaviorDescription
  return "Planetary Motion behavior."
end


on getPropertyDescriptionList  
  return [ ¬
                   #mass: [ ¬
                         #comment: "Mass:", ¬
                          #format: #float, ¬
                         #default: 50.0 ¬
                          ] ¬
                        ]
end  

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail