..:: MX Studio Fóruns ::..: Mudar do click para o rollover ou choque de movies - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Mudar do click para o rollover ou choque de movies

#1 User is offline   leuzinhuuu 

  • Group: Membros
  • Posts: 82
  • Joined: 13-July 05

Posted 01 June 2010 - 01:54 PM

Fala ae rapaziada ...

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");


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);


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");


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;
}


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
0

#2 User is offline   RONYTORRES 

  • Group: Moderadores
  • Posts: 385
  • Joined: 07-December 06

Posted 01 June 2010 - 04:43 PM

E se no código do mc "chuteira" você colocasse assim?

CÓDIGO
onClipEvent (enterFrame) {
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    if (this.hitTest(_root.ball)) {
        _root.ball.gotoAndPlay(1);
    }
}


ou assim:

CÓDIGO
onClipEvent (enterFrame) {
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    if (this.hitTest(_root.ball._x, _root.ball._y, 1)) {
        _root.ball.gotoAndPlay(1);
    }
}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




2 User(s) are reading this topic
0 membro(s), 2 visitante(s) e 0 membros anônimo(s)