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

2016/11/25

Help with finding the fault

Lars2501 Lars2501

2016/11/25

#
I put this code in a World. There is a fault in line 5 with getWorld. I only have no idea what the actual fault is. Can someone help me???
public void act()
    {
        if (bButton.ready() && bButton.ready() && rButton.ready() && yButton.ready())
        {
            getWorld.addObject (new Complete1(), 6,5);
            Greenfoot.delay(200);
            Greenfoot.setWorld(new Finisch());
        }
    }
Super_Hippo Super_Hippo

2016/11/25

#
It would be helpful if you would show the error message. But in this case I think that the code was located in the world class. You can't get the world of the world and you also don't have to. Remove the 'getWorld.'. If this code is in an actor subclass though, you have to add () behind the 'getWorld' because it is a method and not a variable.
Lars2501 Lars2501

2016/11/25

#
Thanks I did it
You need to login to post a reply.