Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2005, 15:26
Daxe
 
Fecha de Ingreso: enero-2005
Mensajes: 97
Antigüedad: 19 años, 3 meses
Puntos: 0
Pregunta Movimiento random con AS, DUDA=PROBLEMA!HELP!!

Hola Terrrricolassss... ggg
saludos foro!
les cuento mi situacion, tengo este codigo con el cual muevo una linea de forma aleatoria (random) de arriba hacia abajo... el problema es q quiero q sean dos lineas, una HORIZONTAL y otra VERTICAL....q se muevan al mismo tiempo. ahi les dejo el codigo a ver si esta amable gente del foro me puede sacar de este atolladero:

// constantes k y c
c = 0.75;
k = 0.06;

n=1; // cantidad de movieclips
for(i=0;i<n;i++){
// hace una copia de "linea1"
duplicateMovieClip("cuadrado","cuadrado"+i,i);
// se asigna el manejador de eventos
_root["linea1"+i].onEnterFrame=mover;
}
linea1._visible=false; // hace invisible al mc original

function mover() {
this.aceleracionx = this.velocidadx-k*(this._x-this.xo);
this.velocidadx = c*this.aceleracionx;
this._x += this.velocidadx;
this.aceleraciony = this.velocidady-k*(this._y-this.yo);
this.velocidady = c*this.aceleraciony;
this._y += this.velocidady;
this._rotation += (this.velocidadx*this.velocidady)/2;
// calcula la distancia entre _x y xo, y entre _y y yo
//si es menor a 1 entonces cambia el valor de xo y yo usando random()
if (Math.abs(this._x-this.xo)<1 and Math.abs(this._y-this.yo)<1) {
this.xo = random(200)+50;
this.yo = random(100)+50;
}
}

MUCHAS GRACIAS::::::TEEEERRRRICOLASSSS!!!!