# How do I make it so that the rollover also exists for the right circle and not just the left circle

**URL:** <https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [May 9, 2023, 5:11pm UTC](https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954 "2023-05-09T17:11:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Computerscience](https://avatars.discourse-cdn.com/v4/letter/c/3da27b/32.png) [@Computerscience](https://discourse.processing.org/u/Computerscience)\
**Post date:** [May 9, 2023, 5:11pm UTC](https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954/1 "2023-05-09T17:11:42Z")

</div>

```auto
var x = 150;
var y = 200;
var d = 200;
var e= 250;

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(255,0,0)
  if (dist(mouseX, mouseY, x, y) < d/2) {
    background(0,255,0);
  } else {
    background(255,0,0);
  }
  fill(0,100)
  ellipse(x, y, d, d);
  ellipse(e, y, d, d);
    
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 9, 2023, 5:38pm UTC](https://discourse.processing.org/t/how-do-i-make-it-so-that-the-rollover-also-exists-for-the-right-circle-and-not-just-the-left-circle/41954/2 "2023-05-09T17:38:07Z")

</div>

> [@Computerscience](#):
>
> ` if (dist(mouseX, mouseY, x, y) < d/2) {`

you can say

```auto
  if (dist(mouseX, mouseY, x, y) < d/2.0 || 
      dist(mouseX, mouseY, e, y) < d/2.0 
           ) {

```

So you can check for both circles in one go.

`||` means OR
