I wanna learn game developing and decided to go with unity. I wanna make game wich is kindind simular to flappy bird but u can go to both directions. The only problem with it is that it goes too fast. I tried lowering the horisontalforce but than it only moves slightly. I tought maybe a speedlimit would help but I don’t know how to do it.
Here is my movement script
public float horisontalForce = 0.6f;
public float verticalForce = 0.4f;
public float maxSpeed = 10f;
float jumpDirection;
void Start()
{
rb = gameObject.GetComponent<Rigidbody2D>();
}
void Update()
{
jumpDirection = Input.GetAxisRaw("Horizontal");
}
void FixedUpdate()
{
if (jumpDirection < -0.1f || jumpDirection > 0.1f)
{
rb.AddForce(new Vector2 (jumpDirection*horisontalForce,verticalForce ),ForceMode2D.Impulse);
}
}`