# Spring and gravity code?

**URL:** <https://forum.kirupa.com/t/spring-and-gravity-code/122606>\
**Category:** Uncategorized\
**Created:** [September 15, 2004, 7:52am UTC](https://forum.kirupa.com/t/spring-and-gravity-code/122606 "2004-09-15T07:52:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanvi](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@tanvi](https://forum.kirupa.com/u/tanvi)\
**Post date:** [September 15, 2004, 7:52am UTC](https://forum.kirupa.com/t/spring-and-gravity-code/122606/1 "2004-09-15T07:52:18Z")

</div>

check this code

onClipEvent (load) {  
k = .2;  
damp = .9;  
grav = .1;  
}  
onClipEvent (enterFrame) {  
ax = (\_root.\_xmouse-\_x)\*k;  
ay = (\_root.\_ymouse-\_y)\*k;  
vx += ax;  
vy += ay;  
vy += grav;  
vx \*= damp;  
vy \*= damp;  
\_x += vx;  
\_y += vy;  
}

tell me where am i going wrong???  
cos after giving the code to mc its not responding in any terms except the drag and drop to the invisible button…  
help me pls
