I'm making a 2d vertical shooter game, in which everything is coded (and working) but the graphics. I have not used the Graphics classes before, so this is all new to me. The following is the code I use to paint everything to the JFrame:
public void paintAll()
{
Graphics h = new Graphics2D();
for(Bullet j : GameState.getEnBullets()){
h.drawImage(j.getImage(),j.getX(), j.getY(), null);}
for(Enemy j : GameState.getEnemies()){
h.drawImage(j.getImage(),j.getX(), j.getY(), null);}
for(Bullet j : GameState.getPlayBullets()){
h.drawImage(j.getImage(),j.getX(), j.getY(), null);}
this.paint(h);
}
The first line "Graphics h = new Graphics2D();" produces an error because Graphics2d is abstract, but I have no idea where to go from here.
I need the code to take all the images that I have and paint them to the points in the JFrame. I remind you that I have never done this before, so please tell me if this is the wrong way to do this.