Visualizzazione dei risultati da 1 a 2 su 2

Discussione: background scrolling

  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    2

    background scrolling

    salve.
    vorrei creare uno sfondo con diversi livelli che si muovono con il movimento del mouse; posto il codice
    frame 1

    startDrag("drag", true);

    frame 2
    xposition = getProperty("menu", _x);
    setProperty("menu", _x, xposition + getProperty("drag", _x) / 8 * -1);
    yposition = getProperty("menu", _y);
    setProperty("menu", _y, yposition + getProperty("drag", _y) / 8 * -1);
    if (getProperty("menu", _x) < -640)
    {
    setProperty("menu", _x, "320");
    } // end if
    if (getProperty("menu", _x) > 320)
    {
    setProperty("menu", _x, -640);
    } // end if
    if (getProperty("menu", _y) < -640)
    {
    setProperty("menu", _y, "320");
    } // end if
    if (getProperty("menu", _y) > 320)
    {
    setProperty("menu", _y, -640);
    } // end if
    xposition = getProperty("front", _x);
    setProperty("front", _x, xposition + getProperty("drag", _x) / 15 * -1);
    yposition = getProperty("front", _y);
    setProperty("front", _y, yposition + getProperty("drag", _y) / 15 * -1);
    if (getProperty("front", _x) < -640)
    {
    setProperty("front", _x, "320");
    } // end if
    if (getProperty("front", _x) > 320)
    {
    setProperty("front", _x, -640);
    } // end if
    if (getProperty("front", _y) < -640)
    {
    setProperty("front", _y, "320");
    } // end if
    if (getProperty("front", _y) > 320)
    {
    setProperty("front", _y, -640);
    } // end if
    xposition = getProperty("mid", _x);
    setProperty("mid", _x, xposition + getProperty("drag", _x) / 30 * -1);
    yposition = getProperty("mid", _y);
    setProperty("mid", _y, yposition + getProperty("drag", _y) / 30 * -1);
    if (getProperty("mid", _x) < -320)
    {
    setProperty("mid", _x, "160");
    } // end if
    if (getProperty("mid", _x) > 160)
    {
    setProperty("mid", _x, -320);
    } // end if
    if (getProperty("mid", _y) < -320)
    {
    setProperty("mid", _y, "160");
    } // end if
    if (getProperty("mid", _y) > 160)
    {
    setProperty("mid", _y, -320);
    } // end if
    xposition = getProperty("back", _x);
    setProperty("back", _x, xposition + getProperty("drag", _x) / 50 * -1);
    yposition = getProperty("back", _y);
    setProperty("back", _y, yposition + getProperty("drag", _y) / 50 * -1);
    if (getProperty("back", _x) < -320)
    {
    setProperty("back", _x, "160");
    } // end if
    ...e così via

    frame 3

    gotoAndPlay(_currentframe - 1);

    Il risultato dovrebbe essere che i vari movie su livelli divesi si muovono con un'accellerazione diversa.
    Ma non funge.
    Cosa sbaglio? oppure qualcuno mi suggerisce un altro modo per raggiungere avere lo stesso effetto?
    Grazie
    -Il Sole-

  2. #2
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    2
    ok, un passo avanti...il codice un pò più raffinato

    xposition = menu._x;
    menu._x=(xposition+drag._x) / 8 * -1;
    yposition = menu._y;
    menu._y=(yposition+drag._y) / 8 * -1;
    if (menu._x< -640)
    {
    menu._x=320;
    } // end if
    if (menu._x>320)
    {
    menu._x=-640;
    } // end if
    if (menu._y<-640)
    {
    menu._y=320;
    } // end if
    if (menu._y> 320)
    {
    menu._y=-640;
    } // end if
    -Il Sole-

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.