Recently, I have been creating a running game (like Temple Run) and I want to know about animations in scripts. This maybe confusing just to let you know. What I want to do is to auto generate my planes. I want some of these to be moving platforms so I would obviously need animations. But as most people know is that if you create an animation, it only works in one spot so I cannot use animations (if you are lost at this point I was just giving some context). What I thought is that I could use the translate tool to act as a substitute for animations to create my Temple Run like game. First I tried to make it go right than wait for 3 seconds then make it go left though it did not work. What I want to do is make my moving platform go left for 3 seconds then after 3 seconds for it to go right and the cycle continues.
Here is what I tried although it didn’t work after going left it looked as if it shaking:
void MoveStart(){
MovingPlatform.transform.Translate (Vector3.left * 3 * Time.deltaTime, Space.World);
WaitForSeconds (3);
MovingPlatform.transform.Translate (Vector3.right * 3 * WaitForSeconds(3), Space.World);
WaitForSeconds (3);
}
To keep is simple how do you make animations in code that can be applied to any gameobject without it teleporting to a specific location as you put the animation there. Btw I also