Ball bouncing and stuff

I “investigated” the tutorial about phisycs n’ stuff and I made this\rwww.hot.ee/syko/ball.swf\rWhat I wanna know is How to make the ball slow down to a full stop?\rYou can download the FLA here\r[url=“http://www.hot.ee/syko/ball.fla”]www.hot.ee/syko/ball.fla\r\rAny help would be appreciated…\r\r\r* btw there are a lot of ways to mess around with the fla (make it go faster all the time, make it slow down, add gravity…)*

i couldn’t look at the file becuase it said unexpected format, both times that i downloaded it, but i nkow that to slow it down you have to add in friction.\r\r\ronClipEvent(load){\rfriction = .92\r}\r\r\radd that to your code, and then multiply that time x and y\r\r_x *= friction \r\r\ror something similar to that. that will slow the ball down.

actually you would want to multiply the speed by friction, not the _x property…unless you wanted the clip to decellerate towards ‘0’ on the _x axis.\r:) \rjeremy

well… it’s not working. The ball was like pulled to one corner all the time like there was a rope attached to it…

oh yeah…oops…my bad…left that step out. yeah you have to multiply your speed variables by the friction, so it would be\r\rxSpeed *= friction\rySpeed *= friction\r_x += xSpeed\r_y += ySpeed\r\ror something like that.

Hey! That worked!!\rThanx guys! What would I do without ya…

Hum… Jubby, when it says unexpected file format, that may be because it’s MX, and not Flash 5 …?\rpom 0]

that would make sense. thanks Pomeranian

Btw, I like the footer Syko. That mask dragging is really easier with MX. snif Poor drag mask tutorial…\rpom 0]

well all those people that are stuck w/ flash 5 will appreciate that tutorial pom…I hopefully will be able to upgrade to MX soon…

onClipEvent(load) {\rgrav = 12;\rfric = 0.8;\r}\r\ronClipEvent(enterFrame) {\rvy += grav;\r_y += vy/5;\rif (_y > screenheight) {\r_y = screenheight\rvy *= -fric;\r}\r}\r\rstick this in a circle movieclip and stick the circle somewhere on the stage, it’ll bounce.\rhope that helped as well.

Thx again guys! You’ve been a great source of help for me!\rAnd Flash MX rocks! It’s much easier to do stuff now…\rLots of good tutorials such as dragging a mask and making a btn fly over the stage with actioscript (which is a piece a cake) a no longer neded anymore…

what is friction??

friction in this case will determine how much the ball will bounce off the ground. more friction will mean less bouncy-ness. in my code i used decimals, but it shouild really be integers. you would divide the velocity of the ball when it hits the ground by negative friction value to get it to bounce back up.