Well, creating the grid is just taking an array[][]. I really don't know how you are attempting to make the grid. Are you using images, Java2D, OpenGL, Slick?
Regardless, if you want to make a simple 10x10 grid and your "block" objects are 16x16. Here is a snippet that might help (assuming Java2D).
1 2 3 4 5 6 7 8 9 10 11 12 13
| Image[][] blockarray = new Image[10][10];
public void render(Graphics g) { g.setColor(Color.BLUE); for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ g.fillRect(16*i, 16*j, i, j); g.drawImage(blockarray[i][j], i*16, j*16, <Component>); } } } |