Hi, we are trying to implement an end turn feature in our game project, which lets you end the turn by pressing space and lets the enemies move forward. So far, we haven't been able to accomplish this at all.
In this code we are trying to prevent movement if PlayerPhase is false (which would be set to false after space is pressed once).
We found it only works when using Greenfoot.isKeyDown, however you have to hold the space bar down the entire time, which is not what we want.
Thanks in advance.
int state = 0;
String key = Greenfoot.getKey();
public boolean PlayerPhase = true;
public void act()
{
if (key != null && key.equals("space"))
{
PlayerPhase = false;
}
if (PlayerPhase != false)
{
if (state == 0)
{
if (Greenfoot.mousePressed(this) == true)
{
state = 0+1;
}
}
else if (state == 1)
{
movement();
if (Greenfoot.mousePressed(this) == true)
{
state = 0;
}
}
}
}

