This site requires JavaScript, please enable it in your browser!
Greenfoot back
zachfreeman
zachfreeman wrote ...

2015/2/23

How to pause a specific actor rather than the entire game?

zachfreeman zachfreeman

2015/2/23

#
How to pause a specific actor rather than the entire game? Any suggestions?
Super_Hippo Super_Hippo

2015/2/23

#
You can use a timer to pause the actor for a specified time. As an alternative, you can also use a boolean.
private int delay = 0;

public void act()
{
    if (delay>0)
    {
        delay--;
        return;
    }
    //rest of the act method
}

public void setDelay(int d)
{
    delay = d;
}
You need to login to post a reply.