# Ball bouncing and stuff

**URL:** https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786
**Category:** Uncategorized
**Created:** [April 8, 2002, 2:47pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786 "2002-04-08T14:47:10Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 2:47pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/1 "2002-04-08T14:47:10Z")

</div>

I “investigated” the tutorial about phisycs n’ stuff and I made this\r[www.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](http://www.hot.ee/syko/ball.swf)\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…)\*

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 3:22pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/2 "2002-04-08T15:22:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 3:58pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/3 "2002-04-08T15:58:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 3:59pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/4 "2002-04-08T15:59:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 4:20pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/5 "2002-04-08T16:20:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 4:33pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/6 "2002-04-08T16:33:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 6:06pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/7 "2002-04-08T18:06:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 6:14pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/8 "2002-04-08T18:14:58Z")

</div>

that would make sense. thanks Pomeranian

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 8:02pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/9 "2002-04-08T20:02:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 8, 2002, 8:08pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/10 "2002-04-08T20:08:27Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 9, 2002, 10:05am UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/11 "2002-04-09T10:05:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 9, 2002, 5:06pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/12 "2002-04-09T17:06:10Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 12, 2002, 4:47pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/13 "2002-04-12T16:47:44Z")

</div>

what is friction??

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 12, 2002, 11:51pm UTC](https://forum.kirupa.com/t/ball-bouncing-and-stuff/2786/14 "2002-04-12T23:51:05Z")

</div>

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.
