title: How to remove a 'bullet ' sprite after it has reached mouseX and mouseY? [P5.Play]
body: <p>I'm making a game using P5.Play, where I have 3 obelisks; one on the left, one on the right and one in the middle. I have made it so if my mouse position is within a specific area of the canvas, the obelisk nearest will shoot towards my mouse position. However I am struggling to find a way to get the sprite to explode once it has reached the x and y point at which when I clicked the mouse. I won't post my full code because it's for an assignment but here is a snippet.</p>
  <pre><code>function mousePressed() { 
      if (mouseX &lt; width / 3) {
          bullet = createSprite(obelisks[0].position.x, obelisks[0].position.y - 60, 20, 20)
      } else if (mouseX &gt; width / 3 &amp;&amp; mouseX &lt; width - width / 3) {
          bullet = createSprite(obelisks[1].position.x, obelisks[1].position.y - 60, 20, 20)
      } else {
          bullet = createSprite(obelisks[2].position.x, obelisks[2].position.y - 60, 20, 20)
      }
  
      // if bullet position is less than the distance between firing point and cursor position, then remove bullet??
  
      bullet.addImage(bulletSprite);
      bullet.attractionPoint(10, mouseX, mouseY);
      bullet.rotateToDirection = true;
  }
  </code></pre>