# Unexpected token: void

**URL:** https://discourse.processing.org/t/unexpected-token-void/25757
**Category:** Coding Questions
**Created:** [November 27, 2020, 12:59pm UTC](https://discourse.processing.org/t/unexpected-token-void/25757 "2020-11-27T12:59:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![muffininwinter](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@muffininwinter](https://discourse.processing.org/u/muffininwinter)
#### Post date: [November 27, 2020, 12:59pm UTC](https://discourse.processing.org/t/unexpected-token-void/25757/1 "2020-11-27T12:59:07Z")

</div>

boolean running = false;  
PImage imgbk;  
PImage imgm;  
PImage albert;  
PImage imgnote;  
PImage[] img = new PImage[2];  
int totalNum = 4;  
int dx, dy;  
int score;  
int startTime;  
int albertX, albertY, albertW, albertH;  
int darwinX, darwinY, darwin

void setup()  
{  
size(850, 700);

imgbk = loadImage(“b.jpg”);  
imgm = loadImage(“m.jpg”);  
imgnote = loadImage(“n.png”);  
albert = loadImage(“a.jpg”);

albertW = 150;  
albertH = 150;  
albertX = int(random(0, width-albertW));  
albertY = int(random(0, height/2-albertH));

dx=5;  
dy=5;

startTime = millis();  
score = 0;

for (int i =0; i \< img.length; i=i+1)  
{  
img[i] = loadImage(“albert” + i + “.jpg”);  
}  
}

void draw() {  
fill(0);  
if (running) {  
image(imgm, 0, 0, width, height);  
image(imgnote, mouseX, mouseY, 100, 130);

```
for (int i = 0; i < img.length; i=i+1)
{
  image(albert[i], albertX, albertY, albertW, albertH);
}

albertX= albertX + dx;
albertY= albertY + dy;
textSize(48);
fill(255, 255, 255);
text("Time: "+ (millis() - startTime)/1000 + "s", 25, 50);
text("Score: "+ score, 25, 100);

if (albertX<0 || albertX>width-albertW)
{ 
  dx=-dx;
}
if (albertY<0 || albertY>height-albertH)
{ 
  dy=-dy;
}

if (albertX+albertW >= mouseX && albertX <= mouseX + 100 && albertY+albertH >= mouseY && albertY <= mouseY + 130)
{
  score = score - 1;
  albertX = int(random(0, width-albertW));
  albertY = int(random(0, height/2-albertH));
}

```

} else {  
image(imgbk, 0, 0, width, height);  
PFont myFont;  
myFont = loadFont(“Rockwell-ExtraBold-65.vlw”);  
textFont(myFont);  
fill(255);  
text(“Start”, 80, 400);  
}  
}  
}

void mousePressed() {  
running = !running;  
}

Not sure what’s wrong with my code T T

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 27, 2020, 1:04pm UTC](https://discourse.processing.org/t/unexpected-token-void/25757/2 "2020-11-27T13:04:48Z")

</div>

Hello,

> [@muffininwinter](#):
>
> Not sure what’s wrong with my code T T

It is not formatted correctly for the forum which makes it difficult to read and copy:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

`:)`

---

<div class="post-metadata">

### Author: ![muffininwinter](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@muffininwinter](https://discourse.processing.org/u/muffininwinter)
#### Post date: [November 27, 2020, 1:12pm UTC](https://discourse.processing.org/t/unexpected-token-void/25757/4 "2020-11-27T13:12:08Z")

</div>

```auto
boolean running = false;
PImage imgbk;
PImage imgm;
PImage albert;
PImage imgnote;
PImage[] img = new PImage[2];
int totalNum = 4;
int dx, dy;
int score;
int startTime;
int albertX, albertY, albertW, albertH;
int darwinX, darwinY, darwin

void setup() 
{
  size(850, 700);

  imgbk = loadImage("b.jpg");
  imgm = loadImage("m.jpg");
  imgnote = loadImage("n.png");
  albert = loadImage("a.jpg");

  albertW = 150;
  albertH = 150;
  albertX = int(random(0, width-albertW));
  albertY = int(random(0, height/2-albertH));

  dx=5;
  dy=5;

  startTime = millis();
  score = 0;

  for ( int i = 0; i < img.length; i=i+1 )
  {
    img[i] = loadImage("albert" + i + ".jpg");
  }
}

void draw() {
  fill(0);
  if (running) {
    image(imgm, 0, 0, width, height);
    image(imgnote, mouseX, mouseY, 100, 130);

    for (int i = 0; i < img.length; i=i+1)
    {
      image(albert[i], albertX, albertY, albertW, albertH);
    }

    albertX= albertX + dx;
    albertY= albertY + dy;
    textSize(48);
    fill(255, 255, 255);
    text("Time: "+ (millis() - startTime)/1000 + "s", 25, 50);
    text("Score: "+ score, 25, 100);

    if (albertX<0 || albertX>width-albertW)
    { 
      dx=-dx;
    }
    if (albertY<0 || albertY>height-albertH)
    { 
      dy=-dy;
    }

    if (albertX+albertW >= mouseX && albertX <= mouseX + 100 && albertY+albertH >= mouseY && albertY <= mouseY + 130)
    {
      score = score - 1;
      albertX = int(random(0, width-albertW));
      albertY = int(random(0, height/2-albertH));
    }
  } else {
    image(imgbk, 0, 0, width, height);
    PFont myFont;
    myFont = loadFont("Rockwell-ExtraBold-65.vlw");
    textFont(myFont);
    fill(255);
    text("Start", 80, 400);
  }
}
}

void mousePressed() {
  running = !running;
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 27, 2020, 2:48pm UTC](https://discourse.processing.org/t/unexpected-token-void/25757/5 "2020-11-27T14:48:02Z")

</div>

Hello,

Something is missing in the line before setup():

`int darwinX, darwinY, darwin`

`:)`
