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
 NTI CD Maker key navigation Color Cycle-Alphamania Checking an open database - Valentina DirectSound Xtra Rollover Fader-Alphamania Dryclean Rotate Image Algorithm - Imaging Lingo Particle Explosion Effect Slider Puzzle by J.R.D.R.

# Orbital Master

 Compatibilities: 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

 Contact MMI 36 South Court Sq Suite 300 Newnan, GA 30263 USA Send e-mail