Hi. I try to use a NumTween to get my hero knockbacked smooth. But my problem is, that the numtween aint getting any more far than the start value. can you maybe tell me what i forgot?
public function knockingBack():void
{
if (knock == true)
{
knodiz = new NumTween(knockbackComplete,0);
knodiz.tween(10, 200, 5);
addTween(knodiz, true);
trace(knodiz.value);
if ((letzteRichtung == "Nord") && (k != 0))
{
moveBy(0,knodiz.value,["solid","schlucht"],true);
}
else if ((letzteRichtung == "Sud") && (k != 0))
{
moveBy(0, -knodiz.value,["solid","schlucht"],true);
}
else if ((letzteRichtung == "West") && (k != 0))
{
moveBy(knodiz.value,0,["solid","schlucht"],true);
}
else if ((letzteRichtung == "Ost") && (k != 0))
{
moveBy(-knodiz.value,0,["solid","schlucht"],true);
}
}
if (k == 0)
{
knock = false;
}
if (knock = false)
{
}
}
private function knockbackComplete():void
{
// stop sliding animation is missing
knodiz.cancel();
k = 0;
}
and do you have any advice for learning the tweening beside just playing around?
/to the code: knockingBack() is called in the update method and with knock:Boolean i shut off the possibility to give additional input