is there any which can help me?
how the script to pause the game?
Thank you
public void act() { if (getWorld().getObjects(BreakMenu.class).isEmpty()) {//BreakMenu.class has to be the classname of the menu; change this if your menu is named different; run(); } } public void run() { //this method is your current act method; //you just have to change the name of your current act method to run (because you got the new act method that calles the run method if there is no break menu); }
public void act() { if (Greenfoot.isKeyDown("esc") && getObjects(BreakMenu.class).isEmpty()) { addObject(new BreakMenu(), getWidth()/2, getHeight()/2); } //may some other stuff. }