
Bueno, hago nuevamente este post de una forma más ordenada, a ver si alguien me puede ayudar.
Si bien esto es parte de un proceso más complejo y completo para un juego, con lo que necesito ayuda es con esto: Necesito que mi MovieClip aparezca desde y=0 y una coordenada x aleatoria entre 0 y 230, hasta ahí no falla. El problema es que desde ahí debe desplazarse hasta cualquier punto aleatorio entre el cuadrante central en rojo, y desde ese punto desplazarse una distancia que lo haga atravesar el cuadrante central a su derecha y desde ahí salir del escenario en movimiento diagonal con inclinación aleatoria sin salirse del cuadarnte superior izquierdo. Se supone que este código lo haga pero muestra unos rebotes extraños en el movimeinto.
Código ActionScript :
var vel:Number = rango(0, 10); this.onEnterFrame = function() { if (rango(0, 25) == 0) { var thisMC:MovieClip = this.attachMovie("109", "avion", _global.cDepth); _global.cDepth++; var tamaño = rango(30, 50); var fin_x = rango(241, 320); var fin_y = rango(163, 240); thisMC._xscale = tamaño; thisMC._yscale = tamaño; thisMC._x = rango(0, 230); thisMC._y = 0; thisMC.onEnterFrame = function() { this._x += 10; this._y += 10; if (this._x>fin_x) { this._x = fin_x; } if (this._y>fin_y) { this._y = fin_y; } if(this._x==fin_x && this._y==fin_y){ this._x +=10; if(this._x>400){ this._x += vel; this._y -= 10; } } }; } }; function rango(minNum:Number, maxNum:Number):Number { return (Math.floor(Math.random()*(maxNum-minNum+1))+minNum); }