I am making a strategy game and to move a unit I need to select it and then click somewhere else to move it there.
I want to "spawn" a flag where I move my unit.
Everything runs fine until I click after clicked an unit to move it, no flag appears and I get a nullpointexception error in console. It also points to this part of my code:
public void mouseClicked(MouseEvent e)
{
addFlag();
}
addFlag code:
public void addFlag() {
Graphics g = getGraphics();
g.drawImage(Ships.flagImage(),mouseX, mouseY, null);
}
There's something Ive missed...
btw, im using the BufferedImage method to load images.

New Topic/Question
Reply



MultiQuote




|