# This Code

**URL:** <https://forum.kirupa.com/t/this-code/26046>\
**Category:** Uncategorized\
**Created:** [July 18, 2003, 9:06pm UTC](https://forum.kirupa.com/t/this-code/26046 "2003-07-18T21:06:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BullDog\_Flash](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@BullDog\_Flash](https://forum.kirupa.com/u/BullDog_Flash)\
**Post date:** [July 18, 2003, 9:06pm UTC](https://forum.kirupa.com/t/this-code/26046/1 "2003-07-18T21:06:02Z")

</div>

This code I found on the net but cant figure out how it works only some of it.

```auto
p_inc = 4;
grav = 2.5;
y = 100;
x = 50;

this.createEmptyMovieClip("cont",1);
cont.lineStyle(2,0x000000);
cont.moveTo(x,y);

_root.onMouseDown = function(){
	d = true;
};

_root.onMouseUp = function(){
	d = false;
};

_root.onEnterFrame = function(){
	power *= .65;
	if(power<0.1){
		power = 0;
	}
	if(d){
		power += p_inc;
	}
	if(y-power>20){
		y -= power;
	}
	else{
		y = 20;
	}
	if(y+grav<180){
		y += grav;
	}
};

```

If one of you Smart Actionscript peopl could tellm me how this code works.

Thanks.
