# Mulitple shakes

**URL:** <https://forum.kirupa.com/t/mulitple-shakes/9639>\
**Category:** Uncategorized\
**Created:** [December 15, 2002, 10:21pm UTC](https://forum.kirupa.com/t/mulitple-shakes/9639 "2002-12-15T22:21:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![postatomic](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@postatomic](https://forum.kirupa.com/u/postatomic)\
**Post date:** [December 15, 2002, 10:21pm UTC](https://forum.kirupa.com/t/mulitple-shakes/9639/1 "2002-12-15T22:21:26Z")

</div>

I got this code which makes and movieclip named box shake when the mouse comes close to it…

I want more than one box to shake yet I can’t make it happen by adding the script to each new movieclip and changing the script and naming the objects differently?

Have a go and see if anyone can help me!!!

Cheers!

postatomic

---

<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:** [December 16, 2002, 12:39am UTC](https://forum.kirupa.com/t/mulitple-shakes/9639/2 "2002-12-16T00:39:58Z")

</div>

Post your code, it’ll make it easier for everyone to help you. I’m sure someone on the board can help you.

Kyle  
\<:}

---

<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:** [December 16, 2002, 9:26am UTC](https://forum.kirupa.com/t/mulitple-shakes/9639/3 "2002-12-16T09:26:58Z")

</div>

yeah that would help wouldn’t it…

startx=box.\_x;  
starty=box.\_y;  
MovieClip.prototype.shakeYourBody=function(radius){  
forceX=2\*(Math.random()-.5)_radius;  
forceY=2_(Math.random()-.5)\*radius;  
this.\_x=startx+forceX;  
this.\_y=starty+forceY;  
}

this.onEnterFrame=function(){  
// Find distance  
var dx=\_xmouse-box.\_x;  
var dy=\_ymouse-box.\_y;  
var distance=dx_dx+dy_dy;  
box.shakeYourBody(100000/(distance+10));  
}

thanks!
