Web Design Forum: Motion Guide Action Script - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Motion Guide Action Script Rate Topic: -----

#1 User is offline   sammyk 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 13
  • Joined: 04-January 12
  • Reputation: 0

Posted 12 January 2012 - 01:18 AM

Hey, I'm really new to Action Script so please be patient. I am trying to make a feather float downward from left to right till the ground. I have managed to do this using motion guide and rotating the feather as it moves along the path. The only problem is when it jumps from left or right it doesn't look smooth and I feel this can only be achieved through Action Script. I'd like the speed to slow down a bit right before it changes direction and if there's any other ways to make this movement as realistic as possible. Thanks so much.
0

#2 User is offline   NickTheGreat 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 27
  • Joined: 01-January 12
  • Reputation: 4
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 26 March 2012 - 04:19 AM

View Postsammyk, on 12 January 2012 - 01:18 AM, said:

Hey, I'm really new to Action Script so please be patient. I am trying to make a feather float downward from left to right till the ground. I have managed to do this using motion guide and rotating the feather as it moves along the path. The only problem is when it jumps from left or right it doesn't look smooth and I feel this can only be achieved through Action Script. I'd like the speed to slow down a bit right before it changes direction and if there's any other ways to make this movement as realistic as possible. Thanks so much.


Try attaching this code to the feather,
onClipEvent(load){
	xvelocity = 12;
	gravity = 3.5;
	factor = 1;
}
onClipEvent(enterFrame){
	xvelocity -= factor;
	_x = _x + xvelocity;
	_y = _y + gravity;
	if(xvelocity < -8){
		factor = -1;
		gravity -= -0.75;
	}
	if(xvelocity > 8){
		factor = 1;
		gravity += 0.75;
	}
	if((xvelocity > -8) && (xvelocity < 8)){
		gravity = 3.25;
	}
	if(this.hitTest(_root.ground)){
	   factor = 0;
	   xvelocity = 0;
	   gravity = 0;
	}
}


And giving the ground (or what makes it stop falling) the instance name of ground.
You can play with the variables to get the look you want, but I think that will work.

Good Luck!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users