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

2016/11/23

My code won't work

Lars2501 Lars2501

2016/11/23

#
Can someone help me find the selution for my code? We want that if all three different classes are in the world. The next world is spanned.
public void act()
    {
        if(!ready() && !start() && getObjects(Complete.class).size() == true)
        {
         Greenfoot.delay(200);
         Greenfoot.setWorld(new Instructiescherm3());
        }
    }
    public boolean ready()
    {
        return getObjects(Complete2.class).size() == true;
    }
    public boolean start()
    {
        return getObjects(Complete3.class).size() == true;
    }
Super_Hippo Super_Hippo

2016/11/23

#
The 'size' method returns a number, not a boolean. You could check if the number is higher than 0. Or you could use the 'isEmpty' method.
You need to login to post a reply.