Is there a command to stop only 1 class for a bit then make it start running again? any help would be appreciated!
private int doNothingTimer = 0;
public void act()
{
if (doNothingTimer>0)
{
doNothingTimer--;
return;
}
//rest of act method
}
public void setDoNothingTimer(int newValue)
{
doNothingTimer = newValue;
}//in actice world subclass
//let all objects of class ABC idle for newValue act cycles
public void stunABC(int newValue)
{
for (ABC abc : getObjects(ABC.class) //use "getWorld().getObjects" if not placed in world subclass
{
abc.setDoNothingTimer(newValue);
}
}private static boolean doNothing = false;
public void act()
{
if (doNothing)
{
return;
}
//rest of act method
}
public static void setDoNothing(boolean newValue)
{
doNothing = newValue;
}//active world subclass
private int abcStunTimer = 0;
public void act()
{
if (abcStunTimer>0)
{
if (--abcStunTimer==0) stunABC(false);
}
}
//let all objects of class ABC idle for newValue act cycles
public void stunABC(int newValue)
{
ABC.setDoNothing(newValue);
}