PDA

View Full Version : Hey 2all any idea on this



deamothul
April 8th, 2003, 03:53 AM
Hail 2 all scripters,:evil:

suppose you have

point A(x,y)
and
point B(x,y)

And you have a line between those points.
How do i make point a and b move across stage while the line keeps in between the two points.
:hangover: :crazy:

Greetz 2 all from
Deamothul - the script keeper - :alien:

kode
April 8th, 2003, 04:25 AM
MovieClip.prototype.square = function(r) {
this.beginFill(0, 100);
this.moveTo(-r, -r);
this.lineTo(r, -r);
this.lineTo(r, r);
this.lineTo(-r, r);
this.lineTo(-r, -r);
this.endFill();
};
MovieClip.prototype.move = function() {
this.x = Math.round(Math.random()*Stage.width);
this.y = Math.round(Math.random()*Stage.height);
this.onEnterFrame = function() {
this._x += (this.x-this._x)/10;
this._y += (this.y-this._y)/10;
if (Math.ceil(this._x) == this.x || Math.ceil(this._y) == this.y) {
this.x = Math.round(Math.random()*Stage.width);
this.y = Math.round(Math.random()*Stage.height);
}
};
};
this.createEmptyMovieClip("l", 0).onEnterFrame = function() {
this.clear();
this.lineStyle(1, 0, 50);
this.moveTo(a._x, a._y);
this.lineTo(b._x, b._y);
};
this.createEmptyMovieClip("a", 1).square(2);
this.createEmptyMovieClip("b", 2).square(2);
a.move();
b.move();
does that help? =)

deamothul
April 8th, 2003, 05:07 AM
:) kax, this helps me BigTime.:)
Thanz a lot and greetz from :
deamothul - the script keeper - :skull:

deamothul
April 8th, 2003, 05:33 AM
:) :) :) :)

kode
April 8th, 2003, 05:33 AM
you're welcome ;)
... and good luck =)