import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Turn here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Turn extends Actor
{
private boolean P1Turn=true;
public Turn()
{
setImage("Counter.png");
}
/**
* Act - do whatever the Turn wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
clickedOn();
}
private void clickedOn()
{
if (Greenfoot.mouseClicked(this))
{
if (P1Turn)
{
P1Turn=false;
}
else
{
P1Turn=true;
}
}
}
}
So this should change the variable P1Turn from true to false or false to true when it is clicked but the variable doesn't change. Anyone know what I'm doing wrong?

