Answered
Movie Clip follow-mouse limit area
this is a follow mouse with elasticity code, works fine.
the problem is about the limit area witch the movieclip can move or not
in the bold area of the code, i can stop the mc but only in one axis,
for ex:
if(x_ziel > 608){ x_ziel = 608; }
it stops following the mouse but only in the _x, it keeps moving the _y (i want both to stop)
if my Movie Clip trespass my "_x" limit, id like to my MC stops also in the _y but with the coordinate that it was just before my mouse trespass it.
onClipEvent (load) {
vx = 0;
vy = 0;
x_wert = this._x;
y_wert = this._y;
x_ziel = this._x;
y_ziel = this._y;
elasticity = 1.6; //1.1, quanto maior menos elastico
tempo = 10; //5, quanto maior menos rapido
}
onClipEvent (enterFrame) {
x_wert = x_wert+vx;
y_wert = y_wert+vy;
vx = (vx+((x_ziel - 528 - x_wert)/tempo))/elasticity;
vy = (vy+((y_ziel - 546 - y_wert)/tempo))/elasticity;
this._x = x_wert;
this._y = y_wert;
}
onClipEvent (mouseMove) {
x_ziel = _root._xmouse;
y_ziel = _root._ymouse;
if(x_ziel > 608){
x_ziel = 608;
}
if(x_ziel < 400){
x_ziel = 400;
}
if(y_ziel > 611){
y_ziel = 611;
}
if(y_ziel < 513){
y_ziel = 513;
}
}
anyone can help me?
the problem is about the limit area witch the movieclip can move or not
in the bold area of the code, i can stop the mc but only in one axis,
for ex:
if(x_ziel > 608){ x_ziel = 608; }
it stops following the mouse but only in the _x, it keeps moving the _y (i want both to stop)
if my Movie Clip trespass my "_x" limit, id like to my MC stops also in the _y but with the coordinate that it was just before my mouse trespass it.
onClipEvent (load) {
vx = 0;
vy = 0;
x_wert = this._x;
y_wert = this._y;
x_ziel = this._x;
y_ziel = this._y;
elasticity = 1.6; //1.1, quanto maior menos elastico
tempo = 10; //5, quanto maior menos rapido
}
onClipEvent (enterFrame) {
x_wert = x_wert+vx;
y_wert = y_wert+vy;
vx = (vx+((x_ziel - 528 - x_wert)/tempo))/elasticity;
vy = (vy+((y_ziel - 546 - y_wert)/tempo))/elasticity;
this._x = x_wert;
this._y = y_wert;
}
onClipEvent (mouseMove) {
x_ziel = _root._xmouse;
y_ziel = _root._ymouse;
if(x_ziel > 608){
x_ziel = 608;
}
if(x_ziel < 400){
x_ziel = 400;
}
if(y_ziel > 611){
y_ziel = 611;
}
if(y_ziel < 513){
y_ziel = 513;
}
}
anyone can help me?