I am making a game where you shoot down birds. I've made an actor that acts as a Crosshair, following the mouse around.
This is the code which is generating the error (setLocation is line 18):
And the error code:
MouseInfo mouse = Greenfoot.getMouseInfo(); setLocation(mouse.getX(), mouse.getY());
java.lang.NullPointerException at Crosshair.act(Crosshair.java:18) at greenfoot.core.Simulation.actActor(Simulation.java:565) at greenfoot.core.Simulation.runOneLoop(Simulation.java:523) at greenfoot.core.Simulation.runContent(Simulation.java:213) at greenfoot.core.Simulation.run(Simulation.java:203)