Hey guys. Sorry for another noob post. I’m still working on my brickbreaker game, but i’m having a bit of trouble figuring out how to set up levels, basically. Right now, i’ve got loading a square of bricks.
public void loadBricks() {
int i = 0;
for(int j= 0; j < 5;j++) {
for (int k = 0;k < 5; k++) {
bricks[i] = new Brick(0,j*32+100,k*16 + 400);
i++;
}
}
}
Very basic as you see and definitely doesn’t do what I need it to do. This is in my game.java class.
And i’m drawing them like this:
batch.begin();
for (int i = 0; i <bricks.length;i++)
{
if (bricks[i].isDestroyed == true) {
bricks[i].brickRect.x = 0;
bricks[i].brickRect.y = 0;
}else{
ball.checkBrickCollision(bricks[i]);
bricks[i].draw(batch);
}}
ball.draw(batch);
paddle.draw(batch);
batch.end();
}
I know I need to use a multidimensional array, but i’m having trouble implementing it. I hope this makes sense, i’m having a little trouble explaining my question…lol
Forgot to add, i’m using LibGDX. I have Game.java, Paddle.java, Ball.java, Brick.java classes.