Tenho banner pra copa, onde preciso criar uma bola que fica pulando no palco e quando eu aproximo meu mouse ( chuteira ) a pelota seja isolada ... o que eu fiz ? achei um código que rola uma animação de embaixadinha, mas ela funciona no momento com o click, eu queria que ela funcionasse com o rollOver ... ou choque de movies, so que não consigo fazer essa função funcionar bem ... alguem teria um help, vou continuar procurando qualquer coisa eu posto aqui a solução ... segue meus códigos.
No primeiro frame do banner.
CÓDIGO
Mouse.hide();
No meu movie bola, com instancia de "Ball"
Primeiro frame
CÓDIGO
g = 20;
kicked = 0;
elastic = 0.800000;
score = 0;
bestscore = 0;
BallRadius = Ball._height / 2;
gotoAndStop("kick");
kicked = 0;
elastic = 0.800000;
score = 0;
bestscore = 0;
BallRadius = Ball._height / 2;
gotoAndStop("kick");
Segundo Frame instanciado como "LoopStart"
CÓDIGO
t = Number(t) + 0.100000;
oldx = x;
oldy = y;
x = getProperty("Ball", _x);
y = getProperty("Ball", _y);
vy = Number(vy) + Number(g / 10);
x = Number(x) + Number(vx / 10);
y = Number(y) + Number(vy / 10);
if (Number(y) < Number(BallRadius))
{
y = BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(y) > Number(189 - BallRadius))
{
if (Number(kicked) == 1)
{
kicked = 0;
if (score > bestscore)
{
bestscore = score;
} // end if
lastscore = score;
score = 0;
} // end if
y = 189 - BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(x) < Number(BallRadius))
{
x = BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
if (Number(x) > Number(301 - BallRadius))
{
x = 301 - BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
setProperty("Ball", _x, x);
setProperty("Ball", _y, y);
setProperty("Ball", _rotation, x);
setProperty("Ball", _xscale, 100);
setProperty("Ball", _yscale, 100);
oldx = x;
oldy = y;
x = getProperty("Ball", _x);
y = getProperty("Ball", _y);
vy = Number(vy) + Number(g / 10);
x = Number(x) + Number(vx / 10);
y = Number(y) + Number(vy / 10);
if (Number(y) < Number(BallRadius))
{
y = BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(y) > Number(189 - BallRadius))
{
if (Number(kicked) == 1)
{
kicked = 0;
if (score > bestscore)
{
bestscore = score;
} // end if
lastscore = score;
score = 0;
} // end if
y = 189 - BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(x) < Number(BallRadius))
{
x = BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
if (Number(x) > Number(301 - BallRadius))
{
x = 301 - BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
setProperty("Ball", _x, x);
setProperty("Ball", _y, y);
setProperty("Ball", _rotation, x);
setProperty("Ball", _xscale, 100);
setProperty("Ball", _yscale, 100);
Terceiro Frame
CÓDIGO
gotoAndPlay("LoopStart");
Quarto Frame instanciado como "kick"
CÓDIGO
oldy = y;
x = getProperty("Ball", _x);
y = getProperty("Ball", _y);
vx = Number((getProperty("Ball", _x) - getProperty("mouse", _x)) * 10) + Number(random(3) / 10 - 0.150000);
vy = Number(-125) + Number(y - getProperty("mouse", _y));
dx = getProperty("Ball", _x) - getProperty("mouse", _x);
if (Number(dx) > 0)
{
vy = Number(vy) + Number(dx);
}
else if (Number(dx) < 0)
{
vy = vy - dx;
} // end if
if (Number(y) < Number(BallRadius))
{
y = BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(y) > Number(189 - BallRadius))
{
if (Number(score) > Number(bestscore))
{
bestscore = score;
} // end if
score = 0;
y = 189 - BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(x) < Number(BallRadius))
{
x = BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
if (Number(x) > Number(301 - BallRadius))
{
x = 301 - BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
setProperty("Ball", _x, x);
setProperty("Ball", _y, y);
setProperty("Ball", _rotation, x);
setProperty("Ball", _xscale, 100);
setProperty("Ball", _yscale, 100);
gotoAndPlay("LoopStart");
x = getProperty("Ball", _x);
y = getProperty("Ball", _y);
vx = Number((getProperty("Ball", _x) - getProperty("mouse", _x)) * 10) + Number(random(3) / 10 - 0.150000);
vy = Number(-125) + Number(y - getProperty("mouse", _y));
dx = getProperty("Ball", _x) - getProperty("mouse", _x);
if (Number(dx) > 0)
{
vy = Number(vy) + Number(dx);
}
else if (Number(dx) < 0)
{
vy = vy - dx;
} // end if
if (Number(y) < Number(BallRadius))
{
y = BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(y) > Number(189 - BallRadius))
{
if (Number(score) > Number(bestscore))
{
bestscore = score;
} // end if
score = 0;
y = 189 - BallRadius;
vx = vx * elastic;
vy = -vy * elastic;
} // end if
if (Number(x) < Number(BallRadius))
{
x = BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
if (Number(x) > Number(301 - BallRadius))
{
x = 301 - BallRadius;
vx = -vx * elastic;
vy = vy * elastic;
} // end if
setProperty("Ball", _x, x);
setProperty("Ball", _y, y);
setProperty("Ball", _rotation, x);
setProperty("Ball", _xscale, 100);
setProperty("Ball", _yscale, 100);
gotoAndPlay("LoopStart");
No meu movie chuteira, com instancia de "tcursor" - lembrando que esse movie deve ficar fora do movie bola.
CÓDIGO
onClipEvent (enterFrame)
{
this._x = _root._xmouse;
this._y = _root._ymouse;
}
{
this._x = _root._xmouse;
this._y = _root._ymouse;
}
Se fizerem tudo certinho vai funcionar da maneira com click ... se alguem puder dar um help pra passar do click pro rollover ... seria otimo, mas mesmo assim segue ae uma animação legal muita usada pra banners de copa...
abs a todos

Help














