Guilherme
YaBB Newbies
Offline
Posts: 15
Missing Right parenthesis
Dec 4th , 2009, 2:12pm
My program doesn't run... It points that there might be a missing right parenthesis at the 86th line(HIT TEST). Maybe I've stuffed too much conditions inside the if()? Here's the code: int tamanho; int[] timer = new int[3]; boolean startGame; boolean pauseGame; boolean endGame; SPACE zone; AVATAR player; MINION[] enemies = new MINION[1]; void setup() { tamanho = 400; startGame = false; pauseGame = false; endGame = false; size(tamanho,tamanho); frameRate(30); zone = new SPACE (loadImage("figura1.png"), loadImage("figura2.png"), loadImage("figura3.png"), color(27,214,219), (tamanho/2), (tamanho/2), (tamanho/15), (tamanho/15)); player = new AVATAR (color(31,155,16), (tamanho/2), (tamanho/2), (tamanho/15), (tamanho/15),(tamanho/80), (tamanho/40)); /*for(int i = 0; i < enemies.length; i++) { enemies[i] = new MINION (color(193,12,12), (tamanho/15), (tamanho/15), (tamanho/80), (tamanho/80)); }*/ } void draw() { background(color(#141B5D)); smooth(); zone.display(); if(endGame == false) { player.display(); if(startGame == true) { zone.alphaPhase = true; player.move(); timer[timer.length]++; //TIMER if(timer[timer.length] > 9) { timer[timer.length - 1]++; timer[timer.length] = 0; if(timer[timer.length - 1] > 9) { timer[timer.length - 2]++; timer[timer.length - 1] = 0; if(timer[timer.length - 2] > 9) { timer[timer.length - 3]++; timer[timer.length - 2] = 0; if(timer[timer.length - 3] > 9) { for(int i = 0; i <= timer.length; i++) { timer[i] = 9; } } } } } for(int i = 0; i < enemies.length; i++) { enemies[i].display(); enemies[i].move(); } //HIT TEST for(int i = 0; i < enemies.length; i++) { if (enemies[i].xpos + enemies[i].xsize / 2 >= player.xpos - player.xsize * 0,4 && enemies[i].xpos + enemies[i].xsize / 2 <= player.xpos + player.xsize * 0,4 && enemies[i].ypos + enemies[i].ysize / 2 >= player.ypos - player.ysize * 0,2 && enemies[i].ypos + enemies[i].ysize / 2 <= player.ypos + player.ysize * 0,2 || enemies[i].xpos - enemies[i].xsize / 2 >= player.xpos - player.xsize * 0,4 && enemies[i].xpos - enemies[i].xsize / 2 <= player.xpos + player.xsize * 0,4 && enemies[i].ypos - enemies[i].ysize / 2 >= player.ypos - player.ysize * 0,2 && enemies[i].ypos - enemies[i].ysize / 2 <= player.ypos + player.ysize * 0,2 || enemies[i].xpos + enemies[i].xsize / 2 >= player.xpos - player.xsize * 0,2 && enemies[i].xpos + enemies[i].xsize / 2 <= player.xpos + player.xsize * 0,2 && enemies[i].ypos + enemies[i].ysize / 2 >= player.ypos - player.ysize * 0,4 && enemies[i].ypos + enemies[i].ysize / 2 <= player.ypos + player.ysize * 0,4 || enemies[i].xpos - enemies[i].xsize / 2 >= player.xpos - player.xsize * 0,2 && enemies[i].xpos - enemies[i].xsize / 2 <= player.xpos + player.xsize * 0,2 && enemies[i].ypos - enemies[i].ysize / 2 >= player.ypos - player.ysize * 0,4 && enemies[i].ypos - enemies[i].ysize / 2 <= player.ypos + player.ysize * 0,4) { endgame = true; } } if(timer % 150 == 0) { MINION enemy = new MINION (color(193,12,12), (tamanho/15), (tamanho/15), (tamanho/80), (tamanho/80)); enemies = (MINION[]) append(enemies,enemy); } } if(startGame == false && pauseGame == true) { zone.pause(); } if(endGame == true) { player.endGame(); zone.endGame(); zone.alphaPhase = true; MINION[] enemies = (MINION[] enemies) subset(); println("Score:" + timer); } } } void mousePressed() { startGame =! startGame; pauseGame = true; if(endgame == true) { endgame == false; } } Thanks in advance.