Hello, I made this code and have encountered an error Null Pointer Exception In my class Asteroid1
I have tried wrapping the code inside the method in an "if getWorld() != null" statement but the same error seems to come up. I also have a method in another class which can destroy the class Asteroid1, is that affecting it?
Thanks
public void createExplosion() { Explosion newExplosion = new Explosion(); int x = getX(); int y = getY(); world.addObject(newExplosion, x, y); }