# Clicked() function? \[Resolved\]

**URL:** <https://discourse.processing.org/t/clicked-function-resolved/8179>\
**Category:** Coding Questions\
**Created:** [February 6, 2019, 10:46pm UTC](https://discourse.processing.org/t/clicked-function-resolved/8179 "2019-02-06T22:46:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurenstrader](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@laurenstrader](https://discourse.processing.org/u/laurenstrader)\
**Post date:** [February 6, 2019, 10:46pm UTC](https://discourse.processing.org/t/clicked-function-resolved/8179/1 "2019-02-06T22:46:33Z")

</div>

Hello, I am following the Coding Train 7.4 tutorial, if anyone has seen this, and I am unable to allow the program to recognize when I click inside the circles. In the video, the functions are formatted like this:

```auto
function mousePressed() {
  for (let i = 0; i < bubbles.length; i++){  
    bubbles[i].clicked(mouseX, mouseY);
}
}

clicked(px,py) {
  let d = dist(px, py ,this.x,this.y);
  if (d < int(this.r/2)){
  	this.brightness = 255;
  console.log("Clicked on bubble");
}
}

```

The system says I need to place a semicolon after clicked, but this is not correct. What is incorrect about clicked()? Do I need to use mouseClicked() instead?

To anybody reading this, I have resolved the issue. No assistance is needed.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [February 8, 2019, 5:38am UTC](https://discourse.processing.org/t/clicked-function-resolved/8179/2 "2019-02-08T05:38:08Z")

</div>

> [@laurenstrader](#):
>
> clicked(px,py)

Did you need to add the `function` keyword in the line above?

I notice you do not need assistance anymore. I suggest you create a new post updating the community about your issue instead of editing your post so people can see your update message promptly. Also, it is encourage to share your solution so to help other forum goers in the feature having the same issues.

Kf

---

<div class="post-metadata">

**Author:** ![Californ1a](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/californ1a/32/2648_2.png) [@Californ1a](https://discourse.processing.org/u/Californ1a)\
**Post date:** [February 12, 2019, 5:33am UTC](https://discourse.processing.org/t/clicked-function-resolved/8179/3 "2019-02-12T05:33:59Z")

</div>

> [@kfrajer](#):
>
> Did you need to add the `function` keyword in the line above?

Seeing as the clicked function has `this.` in it, I’m assuming all he needed to do was move the function to inside the Bubble class, rather than having it outside.
