Hi, this is my first Java 2D game I’m working on. My problem is that, although I’m using a BufferedImage, I can’t seem to make the flicker of my bricks go away. I don’t really know where to put the brick code. Right now the brick code is called within the update(Graphics g){} method (in an Applet). I know why it’s flickering but I don’t know how to fix it. Thanks so much for any help. Here’s the code:
public void drawBrick(){
for(int i = 0; i < 5; i++){
for(int j = i * 10; j < brick.length; j++){
g2d.setTransform(identity);
g2d.translate(brick[j].getPos().getX(), brick[j].getPos().getY());
//Drawing the bricks
g2d.setColor(colorArr()[i]);
g2d.fill(brick[j].getShape());
g2d.setColor(Color.BLACK);
g2d.draw(brick[j].getShape());
}
}
}
If that’s not enough, let me know. Thanks.