i have class player and i have class book, i want if player take a book then game paused, if i press any key game run again..
can you help me, how i make game pause like above?


private int pause = 0;
public void act() { if (pause == 1) { if (Greenfoot.isKeyDown("p"); { pause = 0; } } else if (pause == 0) { if (/* find book boolean */) { pause = 1; } //add your other act stuff } }
if (!hasPaused && !"".equals(takenBook)) { hasPaused = true; setWorld(new BookWorld(takenBook, nameOfWorld)) }