MxSurikov
04.11.2006, 12:41
Код:
var speed = 50;
ball_mc.moveToMouse = function() {
this._x += (this.targetX-this._x)/this._parent.speed;
this._y += (this.targetY-this._y)/this._parent.speed;
this.duplicate();
};
ball_mc.duplicate = function() {
var dupe = this.duplicateMovieClip("dupe"+this._parent.depth, this._parent.depth++);
dupe.onEnterFrame = function() {
this._xscale = this._yscale -= 100;
if (this._xscale<=0) {
this.removeMovieClip();
}
};
};
ball_mc.onMouseDown = function() {
this.targetX = this._parent._xmouse;
this.targetY = this._parent._ymouse;
this.onEnterFrame = this.moveToMouse;
};
Это все о передвижение обьекта в любое место поля, при клике.
Заранее Спасибо.
Еще как можно подправить код, чтобы при клике мыши объект, например человек, разворачивался к указанному месту лицевой частью и соответственно передвигался туда.
Кстате вчера мне пообещали помочь и забыли про меня.
var speed = 50;
ball_mc.moveToMouse = function() {
this._x += (this.targetX-this._x)/this._parent.speed;
this._y += (this.targetY-this._y)/this._parent.speed;
this.duplicate();
};
ball_mc.duplicate = function() {
var dupe = this.duplicateMovieClip("dupe"+this._parent.depth, this._parent.depth++);
dupe.onEnterFrame = function() {
this._xscale = this._yscale -= 100;
if (this._xscale<=0) {
this.removeMovieClip();
}
};
};
ball_mc.onMouseDown = function() {
this.targetX = this._parent._xmouse;
this.targetY = this._parent._ymouse;
this.onEnterFrame = this.moveToMouse;
};
Это все о передвижение обьекта в любое место поля, при клике.
Заранее Спасибо.
Еще как можно подправить код, чтобы при клике мыши объект, например человек, разворачивался к указанному месту лицевой частью и соответственно передвигался туда.
Кстате вчера мне пообещали помочь и забыли про меня.