How would it possible to make a for loop to populate 2 arrays for my worlds x and y positions(800, 600). Such that the arrary is evenly spaced across the dimension x or y, 10 times?
Thanks.


1 2 3 4 5 6 7 8 9 10 11 12 13 | int dy = getHeight/ 10 ; int dx = getWidth()/ 10 ; int y = dy/ 2 ; for ( int j= 0 ; j< 10 ; j++) { int x = dx/ 2 ; for ( int i= 0 ; i< 10 ; i++) { // if array has object at [j][i], addObject at (x, y); x += dx; } y += dy; } |
1 | addObject( new Apple(), x, y); |