Hello guys,
I’m trying to create a game using an 2d array to create a grid of (invisible) squares to put items in them. I’m having trouble moving the grid of squares down because I don’t want them to fit the screen.
Let’s say if my window size is 800,600 how would I let the grid of squares start at 200 (Y)? Thank you so much for your help!! And how would I evenly distribute them over the width of the screen?
I also want to randomize squares with bombs and life points, but they can’t spawn & be too close to eachother, what would be the best option to do this?
int [][]field = new int[30][20];
int space = 5;
for (int x = 0; x < field.length; x++) {
for (int y = 0; y < field[x].length; y++){
fill(speelveld[x][y]);
rect(2xspace, 2yspace, space, space);
}
}
}