need help with an "unexpected token: void" ?
in
Programming Questions
•
2 years ago
PFont arial;
PImage scenery;
PImage helicopter;
color sky = #00CCFF;
int offset;
int hx = 50;
int hy = 125;
int score;
void setup() {
size(300, 250);
scenery = loadImage ("Scenery.png");
helicopter = loadImage ("Helicopter.png");
arial = loadFont("Arial-BoldMT-12.vlw");
textFont (arial);
newGame();
offset = 0;
hy = 125;
hx = 0;
}
void mousePressed() {
newGame();
}
void draw(){
image (scenery, offset, 0);
image (helicopter, hx, hy);
offset= offset - 2;
score= score + 2;
if (keyPressed) {
hy--;
}
else{
hy++;
}
image(scenery, offset, 0);
image(helicopter, hx, hy);
text ("Score: " + score, 5, 16);
color topRight = get(hx + 40, hy);
color bottomRight = get(hx + 40, hy + 29);
if (topRight != sky || bottomRight !=sky) {
gameOver();
}
void mousePressed(); {
newGame();
}
void newGame () {
offset = 0;
score = 0;
hx =50;
hy = height/ 2 - helicopter.height / 2;
loop();
}
void gameOver() {
noLoop();
text("You let the Cow win!!! Click to play again, looooserrrr. ", 10, 130);
}
1