Here is the code for one of my classes, it doesn't run and keeps telling me found one too many { characters without a } to match it...Maybe it's very obvious but i just cant tell...
class evil{
float x1;
float y1;
float x2;
float y2;
float x3;
float y3;
float speedX;
float speedY;
color c;
evil(){
c = color(255,0,0);
x1 = random(width);
y1 = random(height);
x2 = x1 - 6;
y2 = y1 + 10;
x3 = x1 + 6;
y3 = y1 + 10;
speedX = random(-5,5);
speedY = random(-5,5);
}
void display(){
stroke(c);
fill(c);
triangle(x1,y1,x2,y2,x3,y3);
}
void move(){
if(x1 < 0 || x1 > width){
speedX = speedX*-1;
}
if(y1 < 0 || y1 > height){
speedY = speedY*-1;
}
x1 += speedX;
y1 += speedY;
x2 += speedX;
y2 += speedY;
x3 += speedX;
y3 += speedY;
}
void caught(){
x1 = random(width);
y1 = random(height);
x2 = x1 - 6;
y2 = y1 + 10;
x3 = x1 + 6;
y3 = y1 + 10;
score -= 1;
}
}
1