This may look similar to "increase speed after every N seconds" type question but it's different because objects are being Instantiated and getting destroyed.
start() method I'm calling a method called
CreateObstacle() after a certain time interval using
InvokeRepeating("CreateObstacle", 1, 3f);
For those who don't know about the parameters of
InvokeRepeating method. The first one is the method name which you want to call. The second is the number of seconds to delay these repeated calls. And the third parameter is the number of seconds between method calls.
update() method I'm simply storing time per seconds in a float
translation = Time.time;
Then finally in
CreateObstacle() method I'm checking that
if the seconds are less than 10 then
Instantiate ((rocks), new Vector3 (11, -3, 0), Quaternion.identity); else
if seconds are greater than 10 do the same
Instantiate ((rocks), new Vector3 (11, -3, 0), Quaternion.identity); but with more speed.
So, how to increase speed of the object that is being Instantiated after a certain time interval say 10 seconds. On in which method I should call the
InvokeRepeating to decrease it's speed?
but with more speed Explanation:
Rocks are moving from right to left in the screen. And after every 3 seconds a new rock appears, move right to left and get destroyed. So what I want is that after sometime say 10 seconds the speed of right to left motion increase.