So I have flicker displaying images, and a text box for users to enter what they think the pictures are of.
I have a list of Strings consisting of generic terms like "sky", "ocean".
The issue is that after the user guesses the correct term, say its sky, processing continues displaying images with sky.
It also begins showing the ocean images, so you get a mix of sky and ocean pictures and it makes it very difficult to keep on playing the game.
When a search is made through flickr, it returns an arraylist of image results.
I have tried doing flickrImages.clear() after the correct input is made, but that doesnt seem to have any affect what so ever.
Ill post part of the code(a lot of which was provided for me, which may be why I cant figure it out) but just ask if you need to see all of it.
Any other tips for a mediocre programmer would be very appreciated.
Code:// these lists contain the data that is used in drawing
// in order to draw based on content that you load, it must go in some sort of intermediary storage.
java.util.List flickrImages = Collections.synchronizedList(new ArrayList()); // contents: PImage
int MAX_FLICKR_IMAGES = 6;
// *** FLICKR ***
void onFlickrPhotos(FlickrPhotoShortResult[] results) {
while (true) {
// flickr returns 100 results.
// we go through the same 100 results indefinitely.
// if we load all 100, we'll get a scary OutOfMemoryError
for(int i=0;i<results.length;i++) {
PImage flickrImage = loadImage(results[i].getImageUrl());
flickrImages.add(flickrImage);
if(flickrImages.size() > MAX_FLICKR_IMAGES)
flickrImages.remove(0); // pop the bottom one.
}
}
}
...
//this "texts" method gets called when the user hits enter after typing in the text field.
public void texts(String theText) {
//println("a textfield event. "+theText);
if(theText.equals(searchTerm[num])){
println("WIN");
if(num >= 2){
num = 0;}
else{
num += 1;}
flickrImages.clear(); //why doesnt this do anything?
flickrSearch();
}
else{
println("LOSE");
}
}