Im trying to make multiple conditions, when I put like 2 if(condition1 && Condition2) it works fine but when I put more than that, it doesn't work.
Code:
if (Greenfoot.mouseMoved(this))
{ Box1 box1 = new Box1();
Box2 box2 = new Box2();
Box3 box3 = new Box3();
Box4 box4 = new Box4();
Box5 box5 = new Box5();
Box6 box6 = new Box6();
Box7 box7 = new Box7();
Box8 box8 = new Box8();
Box9 box9 = new Box9();
getWorld().addObject(box1,200,184);
getWorld().addObject(box2,218,184);
getWorld().addObject(box3,236,184);
getWorld().addObject(box4,200,202);
getWorld().addObject(box5,218,202);
getWorld().addObject(box6,236,202);
getWorld().addObject(box7,200,220);
getWorld().addObject(box8,218,220);
getWorld().addObject(box9,236,220);
if (box1.touches(iDiamond.class)&&box2.touches(iDiamond.class)&&box3.touches(iDiamond.class)&& box5.touches(Stick.class) && box8.touches(Stick.class))
{
getWorld().addObject(new DiamondPic (), 298,202);
getWorld().removeObjects(getWorld().getObjects(iDiamond.class));
getWorld().removeObjects(getWorld().getObjects(Stick.class));
}
if(box5.touches(WoodenPlank.class) &&box8.touches(WoodenPlank.class))
{
getWorld().removeObjects(getWorld().getObjects(WoodenPlank.class));
getWorld().addObject(new Stick(), 138,19);
}
if (Greenfoot.isKeyDown("x"))
{
getWorld().removeObject(this);
}
}