class Car { float y; float x; float xspeed; float c1; //Light color 1; float c2; //Light color 2; float cdir1; float cdir2; float r; Car (float tempX, float tempY ,float tempXspeed) { x = tempX; y = tempY; xspeed = tempXspeed; c1 = 0; c2 = 255; cdir1 = 8; cdir2 = -8; r =30; } void move() { x = x + xspeed; if ( x > width+15 ) { x = -15; } } void display() { fill(0); stroke(0); rect ( x-8, y-12, 8,5); rect ( x+8, y+12, 8,5); rect ( x-8, y+12, 8,5); rect ( x+8, y-12, 8,5); fill ( 123); rect ( x,y ,30,25); fill(255,243,0); noStroke(); rect ( x+8,y,8,15); rect ( x-8,y,8,15); //Lights stroke(0); fill (0,c1,c2); ellipse(x+15,y-8,4,5); ellipse(x+15,y+8,4,5); // ? noStroke(); fill(0,220,20,0); ellipse(x,y,r,r); c1 = c1 + cdir1; c2 = c2 + cdir2; if ( c1 > 255 || c1 < 0 ) { cdir1*= -1; } if ( c2 >255 || c2 < 0 ) { cdir2*= -1; } } }