crasse 
		
		YaBB Newbies
		 
		Offline 
		
		
		Posts: 13
		
		
		
		
 
	 
	
		
			
				unexpected token: void (also...)  
				 Dec 11th , 2008, 3:02am 
			 
			
				
	  
			 
		
		
			Hi there ! I'm still trying to begin in processing (and I get some problem) I get a "unexpected token:void" error on the "void draw" of the main part, and I don't understand why °_° so if anyone can give me a hand, I would love that, cause I don't know what to do. here is the main part : Boule[] boules = new Boule[20]; float[] x = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; float[] y = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; float[] r = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; float[] m = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; float xv;        float yv; int x_ecran = 400 ; int y_ecran = 400 ; int xMilieu = 300; int yMilieu = 300; int a; int b; float gravite; void setup() {   size(x_ecran,y_ecran);   smooth();      x[0]=100;   x[1]=150;      y[0]=150;   y[1]=220;      r[0]=50;   r[1]=12;      m[0]=7;   m[1]=1;     for(int i=0; i<boules.length; i++){       float r_init = r[i];       float x_init = x[i];       float y_init = y[i];       float m_init = m[i];       boules[i] = new Boule(r_init, x_init, y_init, m_init); }          gravite = .015; void draw() {   background(255);    for(int i=0; i<boules.length; i++){   boules[i].bouge();      a = i;   b = i;   a != b;      boules[a].appliquerGravite(boules[b]);   boules[i].rebondir_ecran();   boules[i].dessine(); } } and also, I don't know if it can be related to this but here is the "boules" class part : class Boule {      float r;    // rayon   float x,y; // position     color c = color(0,0);      float xv = 0;       //vélocité actuelle le long de l'axe des x   float yv = 0;       //vélocité actuelle le long de l'axe des y      float xd;        // Distance to target along x axis    float yd;        // Distance to target along y axis    float d;  // Distance to target       float gAngle;      float gTheta;   //angle en radians   float gxv;      // gravité en x   float gyv;      // gravité en y   float m;      // masse particule      void appliquerGravite(){     gAngle     = calculAngle(x, y, f.x, f.y);     gTheta     = (-(gAngle * PI))/180;     gxv        = cos(gTheta) * (-gravite/(r/6));     gyv        = sin(gTheta) * (-gravite/(r/6));               f.xv += m*f.gxv;     f.yv += m*f.gyv;     xv += m*gxv;     yv += m*gyv;   }          void bouge(){          x       +=   xv; //incr�mente x equivalent a x = x +xspeed     y       +=   yv;        }         void rebondir_ecran(){           if (x > x_ecran-50){          xv = xv-(4/r);}        if(x < 50){          xv = xv+(4/r);}                 if (y > y_ecran-50){           yv = yv-(4/r);}        if(y < 50){          yv = yv+(4/r);}        }            void rebondir(){        xv    *=    -1;    yv    *=    -1;    f.xv  *=    -1;    f.yv  *=    -1;    }    void allume (){       c = color(150,50);   xd = x - f.x;    yd = y - f.y;           }         boolean approche() {       float distance = dist(x,y,f.x,f.y);        calculDistance(x, y, f.x, f.y);       if (d < 2*r + 2*f.r) {       return true;     } else {       return false;     }   }       boolean intersect() {        calculDistance(x, y, f.x, f.y);       if (d < r + f.r) {       return true;     } else {       return false;     }   }      void dessine () {        noStroke();    fill(c);    ellipse(x,y,r*2,r*2);    c = color(0,0,0,128);       }        float calculDistance(float x1, float y1, float x2, float y2){    xd = x1 - x2;    yd = y1 - y2;    d = sqrt(xd * xd + yd * yd);    return d;     }   float calculAngle ( float x1, float y1, float x2, float y2){     float  xd = x1 - x2  ;     float  yd = y1 - y2   ;    float t = atan2 (yd,xd); float a =(180 + (-(180*t) / PI)); return a; } }