i have Greenfoot at school and we got a precoded file with some actors. But when im writing in one actor "Greenfoot.delay(100)", the other actors will stop too. Can someone explain this to me and give me a solution how to make only one actor stop?
int pauseTimer; public void act() { if (pauseTimer > 0 && --pauseTimer > 0) return; // action codes here }
if (some_condition(s) == true) pausing_actor.pauseTimer = numberOfActCyclesToPause;
int pauseTimer; int slowDown; public void act() { if (pauseTimer > 0 && --pauseTimer > 0) return; if (pauseTimer == 0) pauseTimer = slowDown+1; // action code here }
if (someCondition) pauseActor.slowDown++; // increase slow down if (someOtherCondition && pauseActor.slowDown > 0) pauseActor.slowDown--; // decrease slow down