Q:

having trouble getting a moving image disappear on click

I really don't know what I'm doing.  I'm trying to learn JS and it's been touch and go from the start.  I would like to  make a floating image disappear once it is clicked.  I don't think my code is correct.  Any comments or words of advise would be helpful.  
Thanks in advance,
Mario
This is what I am using to make the image to disappear:
 function mousePressed(){
   if(dist(pagex, pageY, chip.xx, chip.yy) < chip/1){
     chip=false;
  }
}

A:

Preferably you should use onclick on the HTML element as it will run your code when clicking directly on the element. No need to check coordinates manually.
The image can be hidden by setting the CSS property display to none.
See this example:

function hideMe(element){
    element.style.display = 'none';
}
<img src="https://placekitten.com/408/287" onclick="hideMe(this);">

