I tried to create a "tile" background for my program. It is not evenly spaced, as it should be. They are spaced 40 pixels apart, so it should be even. Some of the spaces are normal, but others are too small or too large. What am I doing wrong?
John Price aka cc11rocks
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Why don't you use loops?
By only replacing the horizontal tiles with the first loop I already found one mistake in your code: line 53 fills horizontal_tile4 instead of vertical_tile4.
Replacing the vertical tiles with the second loop shows a change in the first argument from 160 to 200 (40 difference) to 220 (just 20 difference) to 260 (40 difference again).
I think that the combination of a) using the wrong tile, thereby missing one vertical tile, and b) the different gap in the vertical tiles, caused the strange results.