Codice PHP:
onClipEvent (load) {
defaultX = this._x;
defaultY = this._y;
magnet = 500;
}
onClipEvent (enterFrame) {
X0 = this._x;
y0 = this._y;
X1 = _root._xmouse;
Y1 = _root._ymouse;
distanceX = X1-X0;
distanceY = Y1-Y0;
distance = Math.sqrt(distanceX*distanceX+distanceY*distanceY);
powerX = this._x-distanceX/distance*magnet/distance;
powerY = this._y-distanceY/distance*magnet/distance;
forceX = (forceX+(defaultX-X0)/2)/1.660000;
forceY = (forceY+(defaultY-Y0)/2)/1.660000;
this._x = powerX+forceX;
this._y = powerY+forceY;
}
non va nemmeno così ma perchèèèèèèèèèèèèèèèèèèèèèèèèèè?