Unable to set image as background
Hi, I am making a java game for school which require myself to have a background image. I keep on getting the same error no matter what I try or change. It keeps saying Identifier Expected.
Here are snippets of my code:
static Image = bgImage1;
Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
Toolkit tk = Toolkit.getDefaultToolkit();
bgImage1 = tk.getImage("sprites/background.jpg");
g.drawImage(bgImage1);
The error comes from the "static Image = bgImage1;" saying an Identifier is Expected. If you think you know the problem but need more information, I'd be glad to throw more details.
Thanks