Bonjour a tous,
Voila j'ai trouvé un effet sympa sur le net à cette adresse :
http://www.tutcity.com/view/opposeable-mou...fect.12532.html.
Le probleme est ...... c'est de l'as1. Je me suis donc mis a faire un petite traduction en as3 a l'aide de mes petites connaissance de d'ébutant

et j'arrive à un resultat proche de l'effet que l'on peut voir sur le tutoriel plus haut. Seulement il saccade un peu et s'exite parfois en evitant mal le curseur. Je pesne donc que quelquechoe est mal traduit... je recherche quelqun qui pourrait peut corriger ma traduction.
Je vous donne le comparatif entre la source (as1) et ma traduc (as3).
voici le code as1 en frame 1 :
-
-
- x00 = _x;
- y00 = _y;
- diam = 1000;
-
-
x00 = _x;
y00 = _y;
diam = 1000;
mon code as3 frame 1 :
-
-
- var x00 = new int();
- var y00 = new int();
- var diam = new int();
-
- x00 = this.x;
- y00 = this.y;
- diam = 1000;
-
-
var x00 = new int();
var y00 = new int();
var diam = new int();
x00 = this.x;
y00 = this.y;
diam = 1000;
le code as1 frame 2 :
-
-
- x0 = _x;
- y0 = _y;
- x = _root._xmouse;
- y = _root._ymouse;
- a = x - x0;
- b = y - y0;
- r = Math.sqrt(a * a + b * b);
- box_dia_x = this._x - a / r * MAAI / r;
- box_dia_y = this._y - b / r * MAAI / r;
- box_div_x = (x00 - x0) / 2;
- box_div_y = (y00 - y0) / 2;
- this._x = box_dia_x + box_div_x;
- this._y = box_dia_y + box_div_y;
-
-
x0 = _x;
y0 = _y;
x = _root._xmouse;
y = _root._ymouse;
a = x - x0;
b = y - y0;
r = Math.sqrt(a * a + b * b);
box_dia_x = this._x - a / r * MAAI / r;
box_dia_y = this._y - b / r * MAAI / r;
box_div_x = (x00 - x0) / 2;
box_div_y = (y00 - y0) / 2;
this._x = box_dia_x + box_div_x;
this._y = box_dia_y + box_div_y;
mon code as3 frame 2 :
-
-
- var x0 = new int ();
- var y0 = new int ();
- var a = new int ();
- var b = new int ();
- var r = new int ();
- var box_dia_x = new int ();
- var box_dia_y = new int ();
- var box_div_x = new int ();
- var box_div_y = new int ();
-
- x0 = this.x;
- y0 = this.y;
- x = root.mouseX ;
- y = root.mouseY ;
- a = x-x0;
- b = y-y0;
- r = Math.sqrt(a * a+b * b);
- box_dia_x = stage.x-a/r * diam/r;
- box_dia_y = stage.y-b/r * diam/r;
- box_div_x = (x00-x0)/2;
- box_div_y = (y00-y0)/2;
- this.x = box_dia_x+box_div_x;
- this.y = box_dia_y+box_div_y;
-
-
var x0 = new int ();
var y0 = new int ();
var a = new int ();
var b = new int ();
var r = new int ();
var box_dia_x = new int ();
var box_dia_y = new int ();
var box_div_x = new int ();
var box_div_y = new int ();
x0 = this.x;
y0 = this.y;
x = root.mouseX ;
y = root.mouseY ;
a = x-x0;
b = y-y0;
r = Math.sqrt(a * a+b * b);
box_dia_x = stage.x-a/r * diam/r;
box_dia_y = stage.y-b/r * diam/r;
box_div_x = (x00-x0)/2;
box_div_y = (y00-y0)/2;
this.x = box_dia_x+box_div_x;
this.y = box_dia_y+box_div_y;
le code as1 et mon as3 frame 3 :
-
-
- gotoAndPlay(2);
