I am making a game based on speed. It is a ball that moves slowly at the start of a level, but increases in speed as it moves. Only problem is, I have no idea how to make in increase in speed with the code I have written (Based on the Brackeys make a game tutorial). Here is the code I have. I would also like the incline of platforms to affect the speed. Thank you in advance!
#pragma strict
var rotationSpeed = 100;
var jumpHeight = 4;
private var isFalling = false;
function Update ()
{
//Handle ball rotation
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed;
rotation *= Time.deltaTime;
rigidbody.AddRelativeTorque (Vector3.back * rotation);
//Handle Jump
if (Input.GetKeyDown(KeyCode.Space) && isFalling == false)
{
rigidbody.velocity.y = jumpHeight;
isFalling = true;
}
}
function OnCollisionStay ()
{
isFalling = false;
}