[ascoders] Re: "perfekte" bewegung
- From: Volker Kreß <kress@xxxxxxxxxx>
- To: ascoders@xxxxxxxxxxxxx
- Date: Thu, 17 Jul 2003 15:48:44 +0200
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
------------------------------------------------------
- References:
- [ascoders] "perfekte" bewegung
- From: Jursa, Jan (init)
Other related posts:
- » [ascoders] "perfekte" bewegung
- » [ascoders] Re: "perfekte" bewegung
- » [ascoders] Re: "perfekte" bewegung
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];
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;
this.createEmptyMovieClip("looper",-1000); looper.onEnterFrame = this.FrameLoopObj();
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 ------------------------------------------------------
- [ascoders] "perfekte" bewegung
- From: Jursa, Jan (init)