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

2021/1/20

Actor not in world error

nicLava nicLava

2021/1/20

#
from the world class trying to get the position of an actor in my list of these actor types i am getting an illegalStateException, i am relatively new to programming and this is the first project ive done entirely on my own and. any tips on why this may be happening?
danpost danpost

2021/1/20

#
nicLava wrote...
from the world class trying to get the position of an actor in my list of these actor types i am getting an illegalStateException, i am relatively new to programming and this is the first project ive done entirely on my own and. any tips on why this may be happening?
Not without seeing the code you are referring to.
nicLava nicLava

2021/1/20

#
public void act()
    {
        for(int i = 0; i <=crew.size() -1; i++)
        {
            Rower t = crew.get(i);
            if(t.getX() >= 600)
            {
                endRace();
            } 
        }
        for(int i = 0; i <=crew.size() -1; i++)
        {
            int count = 0;
            Rower t = crew.get(i);
            if(t.getUpright())
            {
                count++;
            } 
            if(count == crew.size())
            {
                endRace();
            }
        }
    }
says the error is in the first if statement
Super_Hippo Super_Hippo

2021/1/20

#
It seems like a Rower object you get in line 5 isn’t inside a world.
You need to login to post a reply.