DrawShot or drawPlayer or drawEnemy functions are drawn using fillOval and fillPolygon. If you run it, the game runs on a black screen, and I want to create a background class and use an external image as a background. What should I do?
java
Reimplement paintComponent as shown below.
public class Game extends JPanel implements Runnable {
...
...
Image image;
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, this);
}
© 2024 OneMinuteCode. All rights reserved.