Comunidad de diseño web y desarrollo en internet online

velocidad movimiento aleatorio

Citar            
MensajeEscrito el 11 Ago 2007 04:19 pm
Hola a todos!
Tengo este script, y me gustaría añadirle velocidad, ¿como puedo hacerlo? GRacias.
este script lo que hace es que un MC llamado miclip_mc se mueva dentro de otro MC llamado contenedor. Cuando cargo la pelicula se mueve aleatoriamente pero va muy rápido y quiero cambiarlo a mas despacio.



Código :

MovieClip.prototype.random_position = function() {
   x = (this._parent._width-this._width);
   y = (this._parent._height-this._height);
   this._x = (Math.floor(Math.random()*x));
   this._y = (Math.floor(Math.random()*y));
};
contenedor.onEnterFrame = function() {
   _root.contenedor.miclip_mc.random_position();
};

:vader:

Por cristalesrotos

15 de clabLevel



Genero:Masculino  

Tenerife

firefox
Citar            
MensajeEscrito el 11 Ago 2007 05:21 pm
MovieClip.prototype.random_position = function() {
x = (this._parent._width-this._width);
y = (this._parent._height-this._height);
velX = (Math.floor(Math.random()*x));
velY = (Math.floor(Math.random()*y));
this._x += (velX - this._x)/10;
this._y += (velY - this._y)/10;
};

contenedor.onEnterFrame = function() {
_root.contenedor.miclip_mc.random_position();
};

Por Benutti

188 de clabLevel

1 tutorial

 

NutT

msie
Citar            
MensajeEscrito el 15 Ago 2007 09:53 pm
gracias!!

Por cristalesrotos

15 de clabLevel



Genero:Masculino  

Tenerife

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.