I have been trying to make a Hangman game however i have come across some trouble when it comes to making the game change the level to show the next word. I am currently trying to implement a Boolean statement that when all the letters have been pressed and set to true the game changes level to start the next word however when i check the game it says that all letters are true in the boolean statement yet nothing happens. This is my code can anyone help me out.
public static boolean W = false;
public static boolean R = false;
public boolean E = false;
public static boolean N = false;
public static boolean C = false;
public static boolean H = false;
/**
* Constructor for objects of class Prision.
*
*/
public Prison()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
GreenfootImage background = getBackground();
background.drawString("Plumbers use this to fix toilets.", 20, 580);// this is the description for the word
addObject(new W(), 200, 150);// this spawns in all of the letters
addObject(new R(), 200, 190);
addObject(new E(), 200, 230);
addObject(new N(), 200, 270);
addObject(new C(), 200, 310);
addObject(new H(), 200, 350);
addObject(new A(), 200, 390);
addObject(new B(), 200, 430);
addObject(new D(), 200, 470);
addObject(new F(), 260, 160);
addObject(new G(), 260, 200);
addObject(new I(), 260, 240);
addObject(new J(), 260, 280);
addObject(new K(), 260, 320);
addObject(new L(), 260, 360);
addObject(new M(), 260, 400);
addObject(new N(), 260, 440);
addObject(new O(), 310, 150);
addObject(new P(), 310, 190);
addObject(new Q(), 310, 230);
addObject(new S(), 310, 270);
addObject(new T(), 310, 310);
addObject(new U(), 310, 350);
addObject(new V(), 310, 390);
addObject(new X(), 310, 430);
addObject(new Y(), 310, 110);
addObject(new Z(), 200, 110);
addObject(new Timer(), 60, 50);
addObject(new line(), 180, 550);
addObject(new line(), 220, 550);
addObject(new line(), 260, 550);
addObject(new line(), 300, 550);
addObject(new line(), 340, 550);
addObject(new line(), 380, 550);
background.drawLine(500, 60, 350, 60); // this creates the hangman noose
background.drawLine(350, 60, 350, 480);
background.drawLine(350, 480, 500, 480);
background.drawLine(0, 440, 200, 440);
background.drawLine(40, 440, 40, 120);
background.drawLine(40, 120, 160, 120);
background.drawLine(160, 120, 160, 140);
} public void setW()
{
W = true;
}
public void setR()
{
R = true;
}
public void setE()
{
E = true;
}
public void setN()
{
N = true;
}
public void setC()
{
C = true;
}
public void setH()
{
H = true;
}
public void change()
{
if ( W== true && R == true && E == true && N == true && C == true && H == true )
{
Greenfoot.setWorld(new Prison2());
W = false;
R = false;
E = false;
N = false;
C = false;
H = false;
}
}
}
