Ver Mensaje Individual
  #11 (permalink)  
Antiguo 06/12/2008, 17:59
Lain0x
 
Fecha de Ingreso: febrero-2008
Mensajes: 78
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: Movimiento de objeto

Y con el segundo código... tengo que presionar dos veces el botón para que la pelota llegue a arriba, también anda muy cerca:

[CODEinit_x=26;
init_y=338;
max_y=260;
pelota._x=init_x;
pelota._y=init_y;
targety=init_y;
speed=-50;

easing(pelota);
draw
function easing(m:MovieClip)
{

m.onLoad = function()
{

this._x=init_x;
this._y=init_y;

};
m.onEnterFrame = function()
{
if(this._y<max_y)
{
speed=-speed;
}
if(Key.isDown(Key.UP))
{
if(speed<0)
{
targety+=speed;
}
}
if(speed>0)
{
targety=init_y;
if(this._y==targety)
speed=-speed;
}
this._y += Math.ceil((targety-this._y)/2);
};
} ][/CODE]