Adding a Dash in a 2D sidescroller

I’m new to Unity (3 weeks)
So I’m currently making a 2D Sidescroller, got the basic movement (walk, jump and crouch) and combat down, but then I wanted to add a dash movement to my character.

I tried using the rigidbody2D.MovePosition but that just makes my character teleport forward.

Here’s my movement script:

void Update(){
		if (Input.GetKeyDown(KeyCode.UpArrow)) 
			jump = true;
		
		if (Input.GetKeyDown (KeyCode.DownArrow))
			crouch = true;
		else if (Input.GetKeyUp (KeyCode.DownArrow))
			crouch = false;
		
	}

	void FixedUpdate(){
			grounded = Physics2D.OverlapCircle (groundcheck.position, groundedRadius, WhatIsGround);
			anim.SetBool ("Ground", grounded);
			anim.SetBool ("Crouch", crouch);

			anim.SetFloat ("vSpeed", rigidbody2D.velocity.y);
			
			if (Input.GetKeyDown (KeyCode.X))
				rigidbody2D.MovePosition(rigidbody2D.position + speed * Time.deltaTime);

			if (crouch && grounded) {
				jump = false;
				x = (crouch ? x * Cx : x);
			} else if (!crouch)
				x = Input.GetAxis ("Horizontal");
		
			anim.SetFloat ("Speed", Mathf.Abs (x));
			rigidbody2D.velocity = new Vector2 (x * character.MaxSpeed, rigidbody2D.velocity.y);

			if (grounded && jump) {
				anim.SetBool ("Ground", false);
				rigidbody2D.AddForce (new Vector2 (0, character.JumpForce));
			}

			jump = false;

			if (x > 0 && !facingRight)
				Flip ();
			else if (x < 0 && facingRight)
				Flip ();
	}

If anyone can help out, Big Thanks from me :slight_smile:

Instead of MovePosition, you might want to try AddForce.