Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Star Parent Script
DirectX / Direct Show
Get Key Code
Get OS Language
Director 8.5 Studio
RADHTML Viewer
Orbiter
EZ CD Creator
Text Box Xtra
Close Box MIAW behavior
MediaMacros Xtras Mall
 

 

 

Behavior Sin Path Movement

Added on 9/21/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MatthijsKlinkert (website)

Sin Path Movement

--©1999 Matthijs Klinkert, buro Zicht, Delft, The Netherlands
--Startposition X: enter the X-startposition on the stage in pixels.
--Startposition Y: enter the Y-startposition on the stage in pixels.
--Speed: enter the speed of movement 1 = slow, 10 = fast.
--Amplitude: enter the amplitude of the funtion in pixels.
--Period: enter the period of the function in pixels.
--Which direction: choose left or right.
property pMyXpos, pMyYpos, pSpeed, pPeriod, pAmplitude, pMyDirection

on beginSprite me
  
  set the locH of sprite the spriteNum of me = pMyXpos
  set the locV of sprite the spriteNum of me = pMyYpos
  add(the actorList, me)
  
end


on endSprite me
  
  deleteOne(the actorList,me)
  
end

--

on stepFrame me
  
  if pMyDirection = "Right" then
    set pMyXpos = pMyXpos + pSpeed
  else
    set pMyXpos = pMyXpos - pSpeed
  end if
  
  set stageWidth = the stageRight - the stageLeft
  
  if pMyDirection = "Right" then
    if pMyXpos > stageWidth then
      set pMyXpos = 0
    end if
  else
    if pMyXpos < 0 then
      set pMyXpos = stageWidth
    end if
  end if
  
  set the locH of sprite (the spriteNum of me) = pMyXpos
  set x = the locH of sprite the spriteNum of me
  set the locV of sprite (the spriteNum of me) = ¬
pMyYpos + integer(float(pAmplitude*(sin((float(pMyXpos)/float(pPeriod))*PI))))
  set y = the locV of sprite the spriteNum of me
  updateStage
  
end

on getPropertyDescriptionList me  
  set propList = [#pMyXpos: [#comment: "Startposition X (in pixels)", #format: #integer,¬
#default: 0], #pMyYpos: [#comment: "Startposition Y (in pixels)", #format: #integer,¬
#default: 0], #pSpeed: [#comment: "Speed", #range: [1,2,3,4,5,6,7,8,9,10], #format: #integer,¬
#default: 5], #pAmplitude: [#comment: "Aplitude", #format: #integer, #default: 30], ¬
#pPeriod: [#comment: "Period", #format: #integer, #default: 50], ¬
#pMyDirection: [#comment:"Which direction?", #range: ["Left", "Right"], #format: #string,¬
#default: "Right"]]
  return propList  
end

on getBehaviorDescription me  
  return "©1999 Matthijs Klinkert, buro Zicht, Delft, The Netherlands" && RETURN && RETURN &¬
"• Startposition X: enter the X-startposition on the stage in pixels."¬
&& RETURN &¬
"• Startposition Y: enter the Y-startposition on the stage in pixels." && RETURN &¬
"• Speed: enter the speed of movement 1 = slow, 10 = fast." && RETURN &¬
"• Amplitude: enter the amplitude of the funtion in pixels." && RETURN &¬
"• Period: enter the period of the function in pixels." && RETURN &¬
"• Which direction: choose left or right."
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