I’m using iTween to move a gameobject to the right. Basically when the gameobject dies I send it back to a spawnpoint then once the gameobject is returned, this iTween code moves him to the right at a set position in a certain amount of time. The problem is, I don’t want it to be a fixed end position which it seems iTween is forcing me to do which is a problem because the respawn point is always moving which causes the gameobject to move left once you pass the endPosition coordinate.
Instead I just want the gameobject to move to the right a certain distance, say 10 units or so every time it returns to the spawn point. Having a fixed endPosition won’t work for me.
This is the code I’m using. It does what I want but not exactly.
var endPosition : float = 0.0;
var moveTime : float = 0.0;
iTween.MoveTo(gameObject, {"x":endPosition, "time":moveTime, "easetype":"linear", "onComplete":"GoToThisFunction"});
Is there another way to write this or a more straight forward or easier way to move my gameobject to the right a certain distance without the need for a predefined end position with iTween?