I am making a jigsaw game, and am having trouble with when the jigsaw is completed. I want my game so that when all the pieces are in the right place, it runs . The problem is that the world cannot read the boolean (that is in the piece) because that 'cannot be referenced from static context'. I have tried making my piece's inPlace() method static, but then I have the same problem with getX() and getY(). Here is my piece's inPlace() method:
and here is my world's jigsawFinished() method:
(note that I have made it so that only one piece has to be in the right place, this is proof-of-concept for before I use every piece. Also note A1 is the name of the piece)
Thanks.
Greenfoot.stop();
public boolean inPlace()
{
if(getX() == 150 && getY() == 100)
{
return(true);
}
else
{
return(false);
}
} public void jigsawFinished()
{
if(A1.inPlace() == true)
{
Greenfoot.stop();
}
}


