Where is your drawingRectangle() function drawing the rectangle?
Does that position ever change?
If it doesn’t change, all the rectangles are drawn in the same place.
Your sketch has… other issues… but the main concern is that all your rectangles are always being drawn in the same place, no matter what values are stored in any variables…
Please format your Code with Str+T/Ctrl+T in processing and </> in here. And to add to what TfGuy44 said, you are drawing all your rects in one place, so they are all there, just in the exact Same place. If you want to change this, you should give rect variables as Input, not direct numbers. Also, you could probably save a lot of trouble by just using i and j as positions and multiplying them by your desired size and Offset.
By formatting i mean, make the code readable in the Post. Just add the code inside this :
/```
/```
Just without /. You can get this by pressing </> in the top Selection When you write a comment.
And to get the right pattern, you just Need 2 Loops. In one you have to iterate over the rows you want, and in the one inside you Need to set the number of times it has to iterate to the current iteration of the first loop.
Please edit your previous posts to format your code, it is not readable as is.
Regarding your problem, you just need to change one line of your code to get the desired effect.
Just after changing the Y position -> meaning that you are changing the line, you need to set your X position to the initial value (aka 1). It is as simple as that. Almost there!