Skip to content

Commit

Permalink
Fix bug retaining image selection
Browse files Browse the repository at this point in the history
Fix bug introduced by adding a 'chooseImage' function in 436a668 . We need to save that selection in the imageNumber var.
  • Loading branch information
Harry Wood committed May 5, 2019
1 parent e9cbfa5 commit 41fec1c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,19 @@
}
while (count==prevCount)

showImages(count, chooseImage());
chooseImage();
showImages(count, imageNumber);
}

function chooseImage() {
if (fixedImage!=null) {
for (imageNumber = 0; imageNumber < images.length; imageNumber++) {
if (images[imageNumber]["word"].toLowerCase() == fixedImage) {
return imageNumber;
for (var i = 0; i < images.length; i++) {
if (images[i]["word"].toLowerCase() == fixedImage) {
imageNumber = i;
}
}
} else {
return Math.floor(Math.random() * images.length);
imageNumber = Math.floor(Math.random() * images.length);
}
}

Expand Down

0 comments on commit 41fec1c

Please sign in to comment.