I am having an issue with the creation of an object in that when I attempt to add it to the world, I get this error:
Here is where how it is created:
There was no issue with this until I attempted to add in the left variable.
java.lang.NullPointerException at FriendlyBullet.<init>(FriendlyBullet.java:17) at MarioG.shoot(MarioG.java:236) at MarioG.moveMario(MarioG.java:125) at MarioG.act(MarioG.java:52) at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205)
public boolean bLeft = false; public FriendlyBullet() { MyWorld myWorld = (MyWorld)getWorld(); bLeft = myWorld.marioL; }