Hi everyone.
First of all, sorry for my bad english!
So I make a Infinite 2d game.
In this game the player dodges objects. The player doesn’t moves all the other objects moves. Now I want that the objects moves faster after 20 seconds.
I make two scripts but they didn’t work!?
Here is the first script:
function Start() {
InvokeRepeating("Every20Seconds", 20.0, 20.0);
}
var speed : = 4.0;
var addspeed = 0.5;
function Every20Seconds() {
speed = speed + addspeed;
}
function Update() {
transform.Translate(Vector3.down * speed * Time.deltaTime);
}
and here is the other script:
var speed = 4.0;
var addspeed = 0.5;
var timeDelay = 25;
function Start() {
while (true) {
yield WaitForSeconds(timeDelay);
speed= speed + addspeed;
}
}
function Update ()
{
transform.Translate(Vector3.up * speed * Time.deltaTime);
}
Thank you for your help!