Hello everyone,
I found this code:
PFont testo;
String insieme[] = {"4 - 3 =", "5 - 2 ="};
ArrayList charHolder;
ArrayList buffer;
void setup(){
background (0);
size (800,800);
charHolder = new ArrayList();
buffer = new ArrayList();
for(int i = 0; i< insieme.length;i++){
charHolder.add(insieme[i]);
}
testo = createFont("FFScala", 32);
textFont (testo,100);
textAlign (CENTER,CENTER);
frameRate(10);
}
void draw (){
if (keyPressed == true) {
int index = floor(random(charHolder.size()));
text ((String)charHolder.get(index),200 , 100);
buffer.add(charHolder.remove(index));
}
if(charHolder.size() == 0){
charHolder = (ArrayList)buffer.clone();
buffer.clear();
}
}
The problem that you overwrite the new string. It is possible to press key to remove the old string?
thanks
