This site requires JavaScript, please enable it in your browser!
Greenfoot back
Affan
Affan wrote ...

2014/1/3

Java.Lang.Nullpointerexception

Affan Affan

2014/1/3

#
Hello, I made this code and have encountered an error Null Pointer Exception In my class Asteroid1
    public void createExplosion()
    {      
            Explosion newExplosion = new Explosion();
            int x = getX();
            int y = getY();
            world.addObject(newExplosion, x, y);
    }
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
Affan Affan

2014/1/3

#
Nevermind I solved it
You need to login to post a reply.