Let see... The core loop is:
- for(int j = 0; j < height; j = j+sheild){
- matches = 0;
- //check where sheild and uncover array overlap
- for(int q = 0; q < strength; q++){
- if( (uncoverX[q] >= i && uncoverX[q] <= i + sheild) && (uncoverY[q] >= j && uncoverY[q] <= j + sheild) ){
- noFill();
- rect(i , j, sheild, sheild);
- matches = 1;
- }
- else if(matches != 1 ){
- fill(0,255,0);
- rect(i , j, sheild, sheild);
- } //close if
- }//close if
- }//close j loop
I find more readable with less empty lines between lines of code. Note: there is something worse that no comments: incorrect or misleading comments. The one at the line 14 is confusing, as the soft brace closes the q loop!
Let's analyze your loop (I haven't tried to run it, sorry if I am wrong!). You have a complex condition. While it is not meet, you display rectangles in green. Once it is OK, you can noFill, so you draw an empty rectangle and set matches to 1. BTW, if you don't plan to increment it, you should use a boolean here, less confusing with a proper name...
So, once you found your condition, next q rectangles won't be displayed.
Mmm, I don't see the point of overlaying opaque rectangles, now that I think of it...
Result: unless the condition is meet on the first q loop, there will be always at least one rectangle colored opaquely.
Maybe you want to run your q loop and set noFill/fill after it, based on matches result. You can use a break to go out of q loop as soon as you find the proper condition.