# New AS Experiment: Jump Orbs

**URL:** <https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783>\
**Category:** Uncategorized\
**Created:** [April 21, 2003, 1:39am UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783 "2003-04-21T01:39:03Z")\
**Posts on this page:** 14\
**Page:** 2

<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 21, 2003, 4:22pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/21 "2003-04-21T16:22:00Z")

</div>

Alright, everyone here knows my coding isn’t exactly that efficient, I am a very sloppy coder, but here goes the code…

[AS]MovieClip.prototype.drawSquare = function(r, x, y) {  
this.lineStyle(.25, 0x000000, 50);  
this.beginFill(0xE6E6E6, 50);  
this.moveTo(-r, -r);  
this.lineTo(r, -r);  
this.lineTo(r, r);  
this.lineTo(-r, r);  
this.lineTo(-r, -r);  
this.endFill();  
this.\_x = x;  
this.\_y = y;  
};  
MovieClip.prototype.drawSliderLine = function() {  
this.lineStyle(1, 0x000000, 50);  
this.moveTo(0, 0);  
this.lineTo(100, 0);  
};  
MovieClip.prototype.drawCircle = function(x, y, r, lineThickness, RGB, alpha, xpos, ypos) {  
var c1 = r\*(Math.SQRT2-1);  
var c2 = r_Math.SQRT2/2;  
this.lineStyle(lineThickness, RGB[0], alpha[0]);  
this.beginFill(RGB[1], alpha[1]);  
this.moveTo(x+r, y);  
this.curveTo(x+r, y+c1, x+c2, y+c2);  
this.curveTo(x+c1, y+r, x, y+r);  
this.curveTo(x-c1, y+r, x-c2, y+c2);  
this.curveTo(x-r, y+c1, x-r, y);  
this.curveTo(x-r, y-c1, x-c2, y-c2);  
this.curveTo(x-c1, y-r, x, y-r);  
this.curveTo(x+c1, y-r, x+c2, y-c2);  
this.curveTo(x+r, y-c1, x+r, y);  
this.endFill();  
this.\_x = xpos;  
this.\_y = ypos;  
};  
MovieClip.prototype.createSlider = function(x, y, startPos, effectVar) {  
this.createEmptyMovieClip(“sliderLine”, -10).drawSliderLine();  
this.createEmptyMovieClip(“slider”, -9).drawSquare(5, startPos, 0);  
this.slider.onPress = function() {  
this.startDrag(true, 0, 0, 100, 0);  
this.onMouseMove = function() {  
this.\_parent.sliderLabel.text = Math.round(this.\_x);  
this.\_parent.sliderLabel.setTextFormat(myFormat);  
if (effectVar == “affectArea”) {  
affectArea = Math.round(this.\_x);  
} else if (effectVar == “pushDist”) {  
pushDist = Math.round(this.\_x);  
}  
};  
};  
this.slider.onRelease = this.slider.onReleaseOutside=stopDrag;  
this.createTextField(“sliderLabel”, -6, 110, -8, 100, 16);  
this.sliderLabel.text = startPos;  
this.sliderLabel.selectable = false;  
this.sliderLabel.setTextFormat(myFormat);  
this.\_x = x;  
this.\_y = y;  
};  
MovieClip.prototype.jumper = function() {  
this.startX = this.\_x;  
this.startY = this.\_y;  
this.\_xscale = this.\_yscale=this.\_alpha=15;  
this.onMouseMove = function() {  
if (this.\_parent.hitBlock.hitTest(this.\_parent.\_xmouse, this.\_parent.\_ymouse, true)) {  
this.\_x = this.startX;  
this.\_y = this.startY;  
this.dx = this.\_x-this.\_parent.\_xmouse;  
this.dy = this.\_y-this.\_parent.\_ymouse;  
this.hyp = Math.sqrt(this.dx_this.dx+this.dy_this.dy);  
if (this.hyp\<affectArea) {  
this.strength = Math.pow((affectArea-this.hyp)/affectArea, 3);  
this.\_x += pushDist_this.strength_this.dx/this.hyp;  
this.\_y += pushDist_this.strength_this.dy/this.hyp;  
this.\_xscale = this.\_yscale=this.\_alpha=15+100_this.strength;  
} else {  
this.\_xscale = this.\_yscale=this.\_alpha=15;  
}  
} else {  
this.\_x += (this.startX-this.\_x)/5;  
this.\_y += (this.startY-this.\_y)/5;  
this.\_xscale = this.\_yscale=this.\_alpha += (15-this.\_xscale)/5;  
}  
};  
};  
myFormat = new TextFormat();  
myFormat.font = “Verdana”;  
myFormat.size = 10;  
var maxClips = 95;  
var affectArea = 50;  
var pushDist = 25;  
this.createEmptyMovieClip(“hitBlock”, -10).drawSquare(99, 100, 100);  
this.createEmptyMovieClip(“slider1”, -100).createSlider(55, 220, 50, “affectArea”);  
this.createEmptyMovieClip(“slider2”, -99).createSlider(55, 240, 25, “pushDist”);  
this.createEmptyMovieClip(“circle”, -7).drawCircle(0, 0, 20, 5, [0x000000, 0xFFFFFF], [100, 0], 10, 10);  
this.createTextField(“slider1Label”, -1000, 10, slider1.\_y-18, 500, 16);  
slider1Label.text=“Affected Area”, slider1Label.selectable=false, slider1Label.setTextFormat(myFormat);  
this.createTextField(“slider2Label”, -2000, 10, slider2.\_y-18, 500, 16);  
slider2Label.text=“Push Distance”, slider2Label.selectable=false, slider2Label.setTextFormat(myFormat);  
circle.\_visible = false;  
for (var i = 0; i\<maxClips; i++) {  
mc = circle.duplicateMovieClip(“circle”+i, i);  
mc.createEmptyMovieClip(“center”, 1).drawCircle(0, 0, 10, 0, [0x000000, 0x666666], [0, 100], 0, 0);  
mc.\_x = (i\*20)+20;  
while (mc.\_x\>=200) {  
mc.\_x -= 190;  
mc.\_y += 20;  
}  
mc.jumper();  
}[/AS]

---

<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 21, 2003, 4:24pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/22 "2003-04-21T16:24:16Z")

</div>

_drolling_

😛 thats really cool, but to me its complicated. lol

---

<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 21, 2003, 4:28pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/23 "2003-04-21T16:28:50Z")

</div>

lost… i got a cool idea for you  
 ![](http://www.xxviii.net/images/lost.jpg)  
see how that kind of looks like a flower?  
Your next expiriment should involves spiffy flowers like that or something… yup

---

<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 21, 2003, 4:36pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/24 "2003-04-21T16:36:36Z")

</div>

## LoL 28, you’re a dork. 😛 I think LIB has already worked a lot with flowers, anyways. Have you seen his site?

That’s really cool Shane, but not as good as that random moving triangle thingy you did. (I think you did that. I hope you did, or I’m sounding pretty stupid right now…)

---

<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 21, 2003, 4:41pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/25 "2003-04-21T16:41:49Z")

</div>

Ahah, I went to your site to make sure, Shane, and you DID make it! And it’s still awesome! And I was browsing around and it seems to me like you made some sort of ‘new-age flash/photoshop-pen-tool for people that suck’ with that bezier experiment.

I feel like I can actually use the pen tool! _giddy_ Yay! _keeps playing with the bezier thingy_

---

<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 21, 2003, 4:42pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/26 "2003-04-21T16:42:55Z")

</div>

Aislin, yeah ive seen his site, thats why i suggested 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 21, 2003, 4:51pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/27 "2003-04-21T16:51:05Z")

</div>

I was thinking of having a garden this year. I would make lots of flowers. But then I remembered it would take effort.

---

<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 21, 2003, 5:00pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/28 "2003-04-21T17:00:36Z")

</div>

LOL… that bezier curve experiment is OLD I need to update it big time. But you like that eh? Thats all AS as well… check here…

> **[Save BIG with $9.99 .COMs from GoDaddy!](http://www.lostinbeta.com/bezierscript3.html)**
>
> Get your own corner of the Web for less! Register a new .COM for just $9.99 for the first year and get everything you need to make your mark online — website builder, hosting, email, and more.

---

<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 21, 2003, 5:03pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/29 "2003-04-21T17:03:39Z")

</div>

> Syko: Wouldn’t you like to know how I did it hehehe

well of course I would but I was afraid I can’t understand \*\*\*\* about the full code so I just asked the thing I was the most curious about

---

<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 21, 2003, 5:26pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/30 "2003-04-21T17:26:29Z")

</div>

Im just waiting for somone to come along and point out my mistakes that I was hoping no one would notice. I see a few, but I am feeling lazy right now, so screw it… it works, thats all that matters right now to me :P.

---

<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 21, 2003, 5:45pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/31 "2003-04-21T17:45:29Z")

</div>

## I see half a dozen mistakes and a few oddities that could be.

## I’m also lying, because it looks awesome to me.

Yes, the bezier thing is cool. I can use the pen tool now! (In my mind…)

---

<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 21, 2003, 7:09pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/32 "2003-04-21T19:09:24Z")

</div>

I don’t understand that code and I’m too lazy to even try to understand it! So I’m jut gonna wait until I’m not lazy again… 🙂

---

<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 21, 2003, 7:46pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/33 "2003-04-21T19:46:47Z")

</div>

Ok, I made a few very minor changes of some things that were bugging me, and also rearranged some code to make it look sloppier, oh, and added a few little comments in there so its easier to browse through when editing…

[AS]//prototype to draw the square objects  
MovieClip.prototype.drawSquare = function(r, x, y) {  
this.lineStyle(.25, 0x000000, 50);  
this.beginFill(0xE6E6E6, 50);  
this.moveTo(-r, -r);  
this.lineTo(r, -r);  
this.lineTo(r, r);  
this.lineTo(-r, r);  
this.lineTo(-r, -r);  
this.endFill();  
this.\_x = x;  
this.\_y = y;  
};  
//prototype to draw the line for the slider  
MovieClip.prototype.drawSliderLine = function() {  
this.lineStyle(1, 0x000000, 50);  
this.moveTo(0, 0);  
this.lineTo(100, 0);  
};  
//prototype to draw circles  
MovieClip.prototype.drawCircle = function(x, y, r, lineThickness, RGB, alpha, xpos, ypos) {  
var c1 = r\*(Math.SQRT2-1);  
var c2 = r_Math.SQRT2/2;  
this.lineStyle(lineThickness, RGB[0], alpha[0]);  
this.beginFill(RGB[1], alpha[1]);  
this.moveTo(x+r, y);  
this.curveTo(x+r, y+c1, x+c2, y+c2);  
this.curveTo(x+c1, y+r, x, y+r);  
this.curveTo(x-c1, y+r, x-c2, y+c2);  
this.curveTo(x-r, y+c1, x-r, y);  
this.curveTo(x-r, y-c1, x-c2, y-c2);  
this.curveTo(x-c1, y-r, x, y-r);  
this.curveTo(x+c1, y-r, x+c2, y-c2);  
this.curveTo(x+r, y-c1, x+r, y);  
this.endFill();  
this.\_x = xpos;  
this.\_y = ypos;  
};  
//prototype to create the slider bars  
MovieClip.prototype.createSlider = function(x, y, startPos, effectVar) {  
this.createEmptyMovieClip(“sliderLine”, 1).drawSliderLine();  
this.createEmptyMovieClip(“slider”, 2).drawSquare(5, startPos, 0);  
this.slider.onPress = function() {  
this.startDrag(true, 0, 0, 100, 0);  
this.onMouseMove = function() {  
this.\_parent.sliderLabel.text = this.\_parent.\_parent[effectVar]=Math.round(this.\_x);  
this.\_parent.sliderLabel.setTextFormat(myFormat);  
};  
};  
this.slider.onRelease = this.slider.onReleaseOutside=stopDrag;  
this.createTextField(“sliderLabel”, 3, 110, -8, 100, 16);  
this.sliderLabel.text = startPos;  
this.sliderLabel.selectable = false;  
this.sliderLabel.setTextFormat(myFormat);  
this.\_x = x;  
this.\_y = y;  
};  
//prototype for motion  
MovieClip.prototype.jumper = function() {  
this.startX = this.\_x;  
this.startY = this.\_y;  
this.\_xscale = this.\_yscale=this.\_alpha=15;  
this.onMouseMove = function() {  
if (this.\_parent.hitBlock.hitTest(this.\_parent.\_xmouse, this.\_parent.\_ymouse, true)) {  
this.\_x = this.startX;  
this.\_y = this.startY;  
this.dx = this.\_x-this.\_parent.\_xmouse;  
this.dy = this.\_y-this.\_parent.\_ymouse;  
this.hyp = Math.sqrt(this.dx_this.dx+this.dy_this.dy);  
if (this.hyp\<affectArea) {  
this.strength = Math.pow((affectArea-this.hyp)/affectArea, 3);  
this.\_x += pushDist_this.strength_this.dx/this.hyp;  
this.\_y += pushDist_this.strength_this.dy/this.hyp;  
this.\_xscale = this.\_yscale=this.\_alpha=15+100_this.strength;  
} else {  
this.\_xscale = this.\_yscale=this.\_alpha=15;  
}  
} else {  
this.\_x += (this.startX-this.\_x)/5;  
this.\_y += (this.startY-this.\_y)/5;  
this.\_xscale = this.\_yscale=this.\_alpha += (15-this.\_xscale)/5;  
}  
};  
};  
//textbox formatting  
myFormat=new TextFormat(), myFormat.font=“Verdana”, myFormat.size=10;  
//declare variables  
var maxClips = 95, affectArea = 50, pushDist = 25;  
//create all the clips  
this.createEmptyMovieClip(“hitBlock”, -10).drawSquare(99, 100, 100);  
this.createEmptyMovieClip(“slider1”, -100).createSlider(55, 220, affectArea, “affectArea”);  
this.createEmptyMovieClip(“slider2”, -99).createSlider(55, 240, pushDist, “pushDist”);  
this.createEmptyMovieClip(“circle”, -7).drawCircle(0, 0, 20, 5, [0x000000, 0xFFFFFF], [100, 0], 10, 10);  
//create the slider labels  
this.createTextField(“slider1Label”, -1000, 10, slider1.\_y-18, 500, 16);  
slider1Label.text=“Affected Area”, slider1Label.selectable=false, slider1Label.setTextFormat(myFormat);  
this.createTextField(“slider2Label”, -2000, 10, slider2.\_y-18, 500, 16);  
slider2Label.text=“Push Distance”, slider2Label.selectable=false, slider2Label.setTextFormat(myFormat);  
//make the original clip disappear  
circle.\_visible = false;  
//for loop for duplicating clips  
for (var i = 0; i\<maxClips; i++) {  
mc = circle.duplicateMovieClip(“circle”+i, i);  
mc.createEmptyMovieClip(“center”, 1).drawCircle(0, 0, 10, 0, [0x000000, 0x666666], [0, 100], 0, 0);  
mc.\_x = (i\*20)+20;  
while (mc.\_x\>=200) {  
mc.\_x -= 190;  
mc.\_y += 20;  
}  
mc.jumper();  
}[/AS]

---

<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 22, 2003, 4:34pm UTC](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783/34 "2003-04-22T16:34:10Z")

</div>

wow… page 2ed just overnight 😛

::bump::

[Previous page](https://forum.kirupa.com/t/new-as-experiment-jump-orbs/18783.md?page=1)
