I have a team maker, but it has a little animation of randomness" the team only can be 3 people and every time you press enter it puts the name in the team that it shows
the problem comes when the team is full and it chooses another team, it doesn’t show the new team, just the previous (that is full).
sorry for some variables being in Spanish, it’s my native language, but some are in inenglish because I that them in eanglish. Also, I don’t care about optimization, it cost more time than I have.
String myText = "Type something";
int equipo;
boolean seleccionando =false;
int iteracion=0;
int numero;
String[] team1=new String[4];
String[] team2=new String[4];
String[] team3=new String[4];
String[] team4=new String[4];
String[] team5=new String[4];
String[] team6=new String[4];
String[] team7=new String[4];
String[] team8=new String[4];
void setup() {
fullScreen();
textAlign(CENTER, CENTER);
team1[0]="equipo 1";
team2[0]="equipo 2";
team3[0]="equipo 3";
team4[0]="equipo 4";
team5[0]="equipo 5";
team6[0]="equipo 6";
team7[0]="equipo 7";
team8[0]="equipo 8";
for (int i=1; i<4; i++) {
team1[i]=" ";
team2[i]=" ";
team3[i]=" ";
team4[i]=" ";
team5[i]=" ";
team6[i]=" ";
team7[i]=" ";
team8[i]=" ";
}
}
void draw() {
background(255);
fill(0);
textSize(30);
textAlign(CENTER, CENTER);
noFill();
text(myText, 0, 0, width, height);
//TEAM WRITER
textAlign(CENTER);
textSize(15);
for (int i=0; i<8; i++) {
rect(i*width/8, 0, width/8, 150);
}
for (int i=0; i<4; i++) {
text(team1[i], 0, i*40, width/8, 150);
text(team2[i], width/8, i*40, width/8, 150);
text(team3[i], 2*width/8, i*40, width/8, 150);
text(team4[i], 3*width/8, i*40, width/8, 150);
text(team5[i], 4*width/8, i*40, width/8, 150);
text(team6[i], 5*width/8, i*40, width/8, 150);
text(team7[i], 6*width/8, i*40, width/8, 150);
text(team8[i], 7*width/8, i*40, width/8, 150);
}
if (seleccionando == true) {
if (iteracion==5) {
equipo=numero;
print(equipo+"j");
//SECURITY CHECK FOR FULL TEAMS
boolean secure=false;
while (secure==false) {
if (equipo == 1 && team1[3]== " ") {
secure=true;
} else if (equipo==2&&team2[3]==" ") {
secure=true;
} else if (equipo==3&&team3[3]==" ") {
secure=true;
} else if (equipo==4&&team4[3]==" ") {
secure=true;
} else if (equipo==5&&team5[3]==" ") {
secure=true;
} else if (equipo==6&&team6[3]==" ") {
secure=true;
} else if (equipo==7&&team7[3]==" ") {
secure=true;
} else if (equipo==8&&team8[3]==" ") {
secure=true;
} else {
equipo=int(random(1, 9));
}
}
//THEEEEEESE IT SHOULD SHOW THE NEW TEAM BUT IT DOESNT RESPOND
text(str(equipo), 0, height/2+100, width, height/2);
if (equipo==1) {
int i=1;
while (team1[i]!=" ") {
i+=1;
}
team1[i]=myText;
} else if (equipo==2) {
int i=1;
while (team2[i]!=" ") {
i+=1;
}
team2[i]=myText;
} else if (equipo==3) {
int i=1;
while (team3[i]!=" ") {
i+=1;
}
team3[i]=myText;
} else if (equipo==4) {
int i=1;
while (team4[i]!=" ") {
i+=1;
}
team4[i]=myText;
} else if (equipo==5) {
int i=1;
while (team5[i]!=" ") {
i+=1;
}
team5[i]=myText;
} else if (equipo==6) {
int i=1;
while (team6[i]!=" ") {
i+=1;
}
team6[i]=myText;
} else if (equipo==7) {
int i=1;
while (team7[i]!=" ") {
i+=1;
}
team7[i]=myText;
} else if (equipo==8) {
int i=1;
while (team8[i]!=" ") {
i+=1;
}
team8[i]=myText;
}
iteracion=0;
delay(500);
seleccionando=false;
textSize(100);
textAlign(CENTER);
} else { //RANDOM ANIMATION
numero=int(random(1, 9));
textSize(100);
textAlign(CENTER);
text(str(numero), 0, height/2+100, width, height/2);
iteracion+=1;
}
}
}
void keyPressed() {
if (keyCode == BACKSPACE) {
if (myText.length() > 0) {
myText = myText.substring(0, myText.length()-1);
}
} else if (keyCode == DELETE) {
myText = "";
} else if (keyCode == ENTER) {
seleccionando=true;
} else if (keyCode != SHIFT && keyCode != CONTROL && keyCode != ALT) {
myText = myText + key;
}
}