danpost wrote...
Move line 3 to the constructor and remove the enclosing for loop.public Server(int num)
{
number = num;
electionTimeOut = number;
GreenfootImage numImg = new GreenfootImage(""+number, 24, Color.BLACK, new Color(0, 0, 0, 0));
int x = (getImage().getWidth()-numImg.getWidth())/2;
int y = (getImage().getHeight()-numImg.getHeight())/2;
getImage().drawImage(numImg, x, y);
}public void act()
{
move();
Candidate();
}public void Candidate()
{
if(electionTimeOut >0 && --electionTimeOut==0)
{
isCandidate=true;
setLowState(true);
}
}
