title: How to change the path of a shot? (2D)
body: <p>I want my shots to follow a specific pattern (I also need the arc and gap between the shots to be adjustable). Right now I've got my shooting script down but the shots go in a straight line which is not what I want (don't want a straight line now but I'll need it later when designing other weapons).<br>
  Here's a screenshot with example of said saidpatters: </p>
  
  <p><a href="https://i.stack.imgur.com/vVOqU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vVOqU.png" alt="enter image description here"></a></p>
  
  <p>I don't know much about quaternions and angles so all I tried is modifying the angles after x time and the velocity after x time but none worked (it might be the solution but I have 0 clue how to use angles in unity so I couldn't get it to work).<br>
  Another thing please provide an explanation along with your answer because I want to learn why something works the way it does so I don't have to ask again later.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using System;
  
  public class Player_Shooting : MonoBehaviour
  {
      [SerializeField]
      private Transform shootingPoint;
      [SerializeField]
      private GameObject shot; //this is what I'm shooting, shot also has a script but all it does is apply velocity upwards and do damage to enemy if it hits
      private bool shootAgain = true;
      private int dexterity = Player_Stats.GetDexterity();
      private int numberofshots = 2; //amount of shots
      private int shotGap = 5; //how many degrees between the shots
  
      void Update()
      {
          Vector3 mousepos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
          Vector2 direction = new Vector2(mousepos.x - transform.position.x, mousepos.y - transform.position.y);
          transform.up = direction;
          if (Input.GetButton("Fire1") &amp;&amp; shootAgain == true)
          {
              shootAgain = false;
              StartCoroutine(RateOfFire(dexterity));
          }
      }
  
      private void Shoot()
      {
          Vector3 temp = transform.rotation.eulerAngles;
          Quaternion angle = Quaternion.Euler(temp.x, temp.y, temp.z);
          for (int i = 0; i &lt; numberofshots; i++)
          {
              int multiplier = i + 1;
              if (numberofshots % 2 == 1)
              {
                  Instantiate(shot, shootingPoint.position, angle);
                  if (i % 2 == 0)
                  {
                      temp.z -= shotGap * multiplier;
                      angle = Quaternion.Euler(temp.x, temp.y, temp.z);
                  }
                  else
                  {
                      temp.z += shotGap * multiplier;
                      angle = Quaternion.Euler(temp.x, temp.y, temp.z);
                  }
              }
              else if (numberofshots % 2 == 0)
              {
                  if (i % 2 == 0)
                  {
                      temp.z -= shotGap * multiplier;
                      angle = Quaternion.Euler(temp.x, temp.y, temp.z);
                  }
                  else
                  {
                      temp.z += shotGap * multiplier;
                      angle = Quaternion.Euler(temp.x, temp.y, temp.z);
                  }
                  Instantiate(shot, shootingPoint.position, angle);
              }
          }
      }
  
      IEnumerator RateOfFire(int dex)
      {
          Shoot();
          float time = dex / 75;
          time *= 6.5f;
          time += 1.5f;
          yield return new WaitForSeconds(1 / time);
          shootAgain = true;
      }
  }
  </code></pre>