Hi, I am making a 4 player pong game, and I want the ball to increase speed every 10 seconds. heres the code i have so far, im just not sure what to add to it to achieve this.
var temp : Vector3;
function Start()
{
gameObject.rigidbody.AddForce(500,0,500);
}
function OnCollisionEnter(col : Collision)
{
temp = gameObject.rigidbody.Velocity;
Debug.Log("X: " + temp.x + " Y: " + temp.y);
if(temp.x > 0)
{
gameObject.rigidbody.AddForce(-1000, 0, 0);
}
else if(temp.x <0)
{
gameObject.rigidbody.AddForce(1000, 0, 0);
}
if(temp.z > 0)
{
gameObject.rigidbody.AddForce(0, 0, -1000);
}
else if(temp.z <0)
{
gameObject.rigidbody.AddForce(0, 0, 1000);
}
}
function Update()
{
var temp : Vector3 = gameObject.rigidbody.Velocity;
if(temp.x > 0)
{
gameObject.rigidbody.AddForce(-1500, 0, 0);
}
else if(temp.x <0)
{
gameObject.rigidbody.AddForce(1500, 0, 0);
}
if(temp.z > 0)
{
gameObject.rigidbody.AddForce(0, 0, -1500);
}
else if(temp.z <0)
{
gameObject.rigidbody.AddForce(0, 0, 1500);
}
}
enter code here