Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: moto da k._x a var._x

  1. #1

    moto da k._x a var._x

    salve,
    Vorrei far nuovere giocatore1 da una posizione Bx a una posizione variabile Ax.

    Ax<-----------Dt---------Bx
    Dt = (bx - Ax1..2..3...x)
    I = I + 1 (fattore di incremento)
    Moto = (Dt- Ax) + I

    ho scritto questo script, ma mi sa che non è coretto, me lo potete aggiustare?
    codice:
                setProperty(_root.game.gioco.giocatore1, _x, _root.moto);
                _root.Dt = (_root.game.gioco.giocatore1._x  -  _root.game.gioco.omino._x);
                _root.I = _root.I+1;
                _root.moto = _root.I + _root.Dt;
    uhm... come ho scritto si poteva fare ax - I diretto ^^ me so accorto adesso ...quindi è tutto sballato

  2. #2

  3. #3

    ^^

    effettivamente forse mi son spiegato un po in maniera contorta ^^

    vorrei che la mia clip andasse ad un punto x, dove x è il punto dove ho premuto con il pulsate. Però non voglio che ci vadi istantaneamente, ma che vadi con moto uniforme...

  4. #4
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    >uniforme...

    lineare, uniformemente accellerato, uniformemente decelerato?

  5. #5
    ..lineare, kostante.

  6. #6
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Associ al movieclip:

    codice:
    onClipEvent(load){
    	// t: current time, b: beginning value, c: change in value, d: duration
    	Math.linearTween = function (t, b, c, d){return c*t/d + b;};
    	this.movex = this.movey = 0;
    	this.duration = this.time = 20;
    }
    onClipEvent(enterFrame){
    	if(this.time > this.duration)return
    	this._x = Math.linearTween(this.time, this.beginx, this.movex, this.duration)
    	this._y = Math.linearTween(this.time, this.beginy, this.movey, this.duration)
    	this.time++
    }
    onClipEvent(mouseDown){
    	this.movex = _root._xmouse - (this.beginx = this._x);
    	this.movey = _root._ymouse - (this.beginy = this._y);
    	this.time = 0;
    }

  7. #7

    ^^

    provato, ma non funziona ..si muove dove vuole lui... e non dove ho cliccato

  8. #8
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Il movieclip è annidato dentro un altro?

  9. #9

    k

    si, provo a dare tutti i target levando i this

  10. #10

    bau

    da sempre lo stesso errore, posto lo script cambiato :

    codice:
    onClipEvent (load) {
        // t: current time, b: beginning value, c: change in value, d: duration
        t = 1;
        b = 1;
        d = 1;
        c = 4;
        Math.linearTween = function(t, b, c, d) {
            return c*t/d+b;
        };
        _root.game.gioco.giocatore1.movex = _root.game.gioco.giocatore1.movey=0;
        _root.game.gioco.giocatore1.duration = _root.game.gioco.giocatore1.time=20;
    }
    onClipEvent (enterFrame) {
        if (_root.game.gioco.giocatore1.time>_root.game.gioco.giocatore1.duration) {
            return;
        }
        _root.game.gioco.giocatore1._x = math.lineartween(_root.game.gioco.giocatore1.time, _root.game.gioco.giocatore1.beginx, _root.game.gioco.giocatore1.movex, _root.game.gioco.giocatore1.duration);
        _root.game.gioco.giocatore1._y = math.lineartween(_root.game.gioco.giocatore1.time, _root.game.gioco.giocatore1.beginy, _root.game.gioco.giocatore1.movey, _root.game.gioco.giocatore1.duration);
        _root.game.gioco.giocatore1.time++;
    }
    onClipEvent (mouseDown) {
        _root.game.gioco.giocatore1.movex = _root._xmouse-(_root.game.gioco.giocatore1.beginx=_root.game.gioco.giocatore1._x);
        _root.game.gioco.giocatore1.movey = _root._ymouse-(_root.game.gioco.giocatore1.beginy=_root.game.gioco.giocatore1._y);
        _root.game.gioco.giocatore1.time = 0;
    }
    ho provato... funziona, ma se lo metto all'interno di un clip nidificato non va + ;-(

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.