[ascoders] AW: Re: "perfekte" bewegung

Wow.
Vielen Dank.
Schaue ich mir gleich an.
Grüsse,
jan



-----Ursprüngliche Nachricht-----
Von: Volker Kreß [mailto:kress@xxxxxxxxxx] 
Gesendet: Donnerstag, 17. Juli 2003 15:49
An: ascoders@xxxxxxxxxxxxx
Betreff: [ascoders] Re: "perfekte" bewegung



  LoopObjs = {};

  AddLoopObj = function  (obj) {
        _root.LoopObjs[obj] = obj;
     };

MovieClip.prototype.LoopObj = function  (Func, funcArgm) {
         if (this.lo_Action != true) {
                        this.____count = 0;
             _root.addLoopObj(this);
            this.FuncArray = new Array ();
            this.ArgmArray = new Array ();
            this.ArgmArray[this.____count] = funcArgm;
            this.FuncArray[this.____count] = this.Func;
            this.Func = _root[Func];

            this.funcArgm = funcArgm;
            this.lo_Action = true;
            this.vorhanden = true
         } else {
                        this.____count++
             this.funcArray[this.____count] = _root[Func];
             this.ArgmArray[this.____count] = funcArgm;
               }
     };

MovieClip.prototype.killLoop = function  () {


         if (this.____count == 0) {                     
             delete _root.LoopObjs[this];
             delete this.funcArgm;
             delete this.Func;
             //this.FuncArray = null
             delete this.FuncArray;
             // this.ArgmArray = null
             delete this.ArgmArray;
             delete this.____count;
             this.lo_Action = false;


         } else {
                        this.ArgmArray.shift();
             this.FuncArray.shift();
             this.Func = this.funcArray[0];
             this.funcArgm = this.ArgmArray[0];

                        this.____count--
          }
     }
MovieClip.prototype.killAllLoops = function(){
        this.killLoop(this)
        this.____count = 0
}
MovieClip.prototype.ArgmSplit = function  (Argm) {
        var Argm = Argm.split(",");

         return (Argm);
     }


FrameLoopObj = function  () {

         for  (My_obj in LoopObjs) {
                        LoopObjs[My_obj].Func(LoopObjs[My_obj].funcArgm);
                        if (! LoopObjs[My_obj].vorhanden) delete
loopObjs[my_obj]

         }
     }




MoveTo = function  (funcArgm) {
                
                // _x,_y,speed
                
         var x = funcArgm[0];
         var y = funcArgm[1];
         var delta = funcArgm[2];
         var distX = x - this._x;
         var distY = y - this._y;

         var dist = Math.sqrt((distX * distX) + (distY * distY));
         if (delta < dist) {
             var dx = (distX / dist) * delta;
             var dy = (distY / dist) * delta;
         } else {
             var dx = distX;
             var dy = distY;
             this.killLoop(this)

          }
         this._x  = (this._x + dx);
         this._y  = (this._y + dy);

}


this.createEmptyMovieClip("looper",-1000);
looper.onEnterFrame = this.FrameLoopObj();


// is zwar schon ein paar Jahre alt aber damit mache ich immer noch 
alle Bewegungen


Volker


Am Donnerstag, 17.07.03 um 15:37 Uhr schrieb Jursa, Jan (init):

> Hi leute,
>
> jedesmal wenn ich eine zB. horizontale Bewegung scripte, ärger ich 
> mich über
> das unbefriedigende ergebnis:
>
> irgendwie ist die bewegung nicht wirklich "flüssig". Ab und an sind 
> ganz
> seltsame Ruckler drinn (in Abhängigkeit des Rechners auf dem ich 
> teste)...es
> ist einfach NIE PERFEKT ;-)
>
> egal ob ich es so versuche:
>
> function moveTest() {
>       test_mc._x-=.5;
> }
> this.onEnterFrame=moveTest;
>
> oder diese richtung gehe
>
> function moveTest() {
>       test_mc._x++;
> }
> var intervalTest = setInterval(moveTest, 10);
>
>
> was habt ihr für lösungen die wirklich guuuut mooooven ?
>
> grüsse,
> jan
>
>
> ------------------------------------------------------
> Archiv   : http://www.freelists.org/archives/ascoders/
> Optionen : http://www.freelists.org/list/ascoders
> ------------------------------------------------------

------------------------------------------------------
Archiv   : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------
------------------------------------------------------
Archiv   : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------

Other related posts: