Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: DJVDJV on August 10, 2015, 07:52:28 PM
-
I use moving from place "start" to place "end" this kind:
transform.DOMove(end, 1); .. and it is ok.
1 st question:
Now I need tween that moves transform half way to "end" and then back to "start" (in 1 sec) (I use it as attack movement in tile based game)
How I do it DOTween?
2 st question:
I need tween cannonball as "bow" from "start" to "end" this: transform.DOMove(end, 1); do straight line. (Something that birds fly in Angry Birds or cannon ball in tank games)
How to do it in DOTween?
3 rd question:
I need tween boolean value that is set to true.. but is set to false after 2.5 sec.. How to doit wit DOTween?
-
Hi,
1st question
You should create another tween in that case
2nd question
You can apply a DOJump (http://dotween.demigiant.com/documentation.php?api=DOJump__2) tween, to choose the height of the jump and thus create an arc
3rd question
Check out DOVirtual.DelayedCall (http://dotween.demigiant.com/documentation.php?api=DOVirtual.Delayed)
-
Hmm how to make call back with parameter?
I get this work:
void DoAct()
{
DOVirtual.DelayedCall(attackMoveSpeed, moveBack, false);
}
void moveBack()
{
transform.DOMove(attackStartLocation, attackMoveSpeed);
}
I would like to do (But I bet compile error)
void DoAct(vector3 location)
{
DOVirtual.DelayedCall(attackMoveSpeed, moveBack(location), false);
}
void moveBack(vector3 location)
{
transform.DOMove(location, attackMoveSpeed);
}
also how to make call "inline" for example if I want just change boolean and does not want to do own method for it?
Something like: DOVirtual.DelayedCall(2.5f, isBusy = false, false);
-
Instead of this:
DOVirtual.DelayedCall(attackMoveSpeed, moveBack(location), false);
you should pass just the function name:
DOVirtual.DelayedCall(attackMoveSpeed, moveBack, false);
And to make it inline you can use a lambda instead:
DOVirtual.DelayedCall(attackMoveSpeed, ()=> isBusy = false, false);
-
This one:
"
DOVirtual.DelayedCall(attackMoveSpeed, moveBack(location), false);
you should pass just the function name:
DOVirtual.DelayedCall(attackMoveSpeed, moveBack, false);
"
But how to pass location as parameter?
-
Sorry I should've specified that. DelayedCall doesn't accept parameters, so you can only call methods that have no parameters. Or use another type of lambda like this:
DOVirtual.DelayedCall(attackMoveSpeed, ()=> moveBack(location), false);
-
Now it works. Thanks LOT!
-
Great :)