You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

class Equipe {
int id, score, radius;
float pos_x, pos_y;
String membres;
color couleur;
Pion pion;
Equipe(int id) {
this.id = id;
this.score = 0;
//float randomHue = random(255);
//float randomSaturation = random(100,255);
//float randomBrightness = random(80,255);
//color inverseText = color(float(255)-randomHue, float(255)-randomSaturation, float(255)-randomBrightness);
//this.couleur = color(randomHue, randomSaturation, randomBrightness);
//this.pion = new Pion(this.id, this.couleur, inverseText);
// générer un pion pour l'équipe
this.pion = new Pion(this.id);
// récupérer les valeurs de positionnement initial du pion
this.pos_x = this.pion.posX;
this.pos_y = this.pion.posY;
this.radius = this.pion.radius;
// afficher l'emplacement de l'équipe avant le pion
this.update();
}
void update() {
// affichage de l'emplacement d'équipe, qui restera toujours fixe
color bgColor = color(235, 112, 71, 0.8);
color textColor = color(200);
fill(bgColor);
stroke(bgColor);
strokeWeight(0.5);
circle(this.pos_x,this.pos_y,radius);
fill(textColor);
float textSize = this.radius/4*3;
textSize(textSize);
float pos_x = this.id<9? this.pos_x-radius/5: this.pos_x-radius/3;
text(this.id+1, pos_x, this.pos_y+radius/5);
// mise à jour du pion
this.pion.draw();
}
void setScore(int score) {
this.score = score;
println("Equipe", this.id+1, "setScore", score);
}
}