• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2D inconsistencies

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks,
John Price aka cc11rocks
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much!
John Price aka cc11rocks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic