# Problem with Scoreboard in game

**URL:** https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892
**Category:** Coding Questions
**Created:** [May 15, 2020, 1:30am UTC](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892 "2020-05-15T01:30:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jaiy](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jaiy](https://discourse.processing.org/u/jaiy)
#### Post date: [May 15, 2020, 1:30am UTC](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892/1 "2020-05-15T01:30:11Z")

</div>

Having some issues with my scoreboard I am trying to use missed++ whenever the ellipse hits the line before the scoreboard missed should plus one every time but it does not work. If someone could help me that would be great.  
This is what I had put into the void mousePressed function.

```auto
void mousePressed() {
  if( dist(mouseX, mouseY, x, y) < 25 ){
    hits++;
    score++;
    y = 25;
    x = (int)random(25,475);
  }
  if(y > 575){
    y = 25;
    missed++;
  }
  
  if(hits == 0){
    hits = 0;
    missed++;
  }
  
}

```

This is what my draw function looks like.

```auto
void draw(){
  background(p);
  fill(#DFF218);
  ellipse(x,y,50,50);
  y+=5;
 if(y >= height){
    y = 25;
    x = (int)random(25,475);}
    if(y > 575){
     y = 25;
     x = (int)random(25,475);
    }
  fill(0);
  textSize(25);
  textAlign(CENTER);
  text("Score= " + score, 100,650);
  text("Missed= " + missed, 250,650);
  text("Hits= " + hits, 400,650);
}

```

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 15, 2020, 1:56am UTC](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892/2 "2020-05-15T01:56:40Z")

</div>

I still don’t see any comments.

What does this do?

> [@jaiy](#):
>
> ```auto
> if(hits == 0){
> hits = 0;
> missed++;
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [May 15, 2020, 2:00am UTC](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892/3 "2020-05-15T02:00:11Z")

</div>

Also your indenting is weird for these if statements. Hit Ctrl + t to auto-format your code in the Processing IDE.

You probably don;t need both of these checks. The second one covers the first case just fine.

> [@jaiy](#):
>
> ```auto
> if(y >= height){
> y = 25;
> x = (int)random(25,475);
> }
> 
> if(y > 575){
> y = 25;
> x = (int)random(25,475);
> }
> 
> ```
