Unity 2D Platformer Gerakan Skrip Rigidbody

float acceleration = grounded ? walkAcceleration : airAcceleration;
float deceleration = grounded ? groundDeceleration : 0;

// Update the velocity assignment statements to use our selected
// acceleration and deceleration values.
if (moveInput != 0)
{
	velocity.x = Mathf.MoveTowards(velocity.x, speed * moveInput, acceleration * Time.deltaTime);
}
else
{
	velocity.x = Mathf.MoveTowards(velocity.x, 0, deceleration * Time.deltaTime);
}
Sleepy Swan