I don’t understand the if statement that says if (Speed > Deceleration Time.deltaTime) , how does this stop the object’s speed to 0?
if ((Input.GetKey("left")) && (Speed < MaxSpeed))
Speed = Speed - Acceleration * Time.deltaTime;
else if ((Input.GetKey("right")) && (Speed > -MaxSpeed))
Speed = Speed + Acceleration * Time.deltaTime;
else {
if (Speed > Deceleration Time.deltaTime)
Speed = Speed - Deceleration * Time.deltaTime;
else if (Speed < -Deceleration Time.deltaTime)
Speed = Speed + Deceleration * Time.deltaTime;
else Speed = 0;
}
transform.position.x = transform.position.x + Speed * Time.deltaTime;