I’m making a pacman clone and i’m trying to make a pause menu which is just painted on top of the game with transparency to look cool, problem is it paints over and over again making the menu opaque.
To stop this i can continue to paint the normal game underneath the overlay but if i do this it makes things animate as i call player.drawImage(g2d) which then goes and makes the player move onto next animation frame even though the game is paused, so i really don’t want to run the drawing code for the normal game at all.
I tried ‘screen shoting’ the game when i pause it making a copy of the buffer and storing in a buffered image drawing that and then the transparent menu to avoid calling the draw methods for tiles and player but this didn’t seem to work very well, i think it was the way i copied the image via bufferedimage.getRaster(), i also tried just doing pauseBuffer = buffer type of copying but this didn’t seem to work. Anyone know anyway i can make this work without having to add loads of checks in individual classes draw code to check if the game is paused?