Fix continue bug

master
John 2022-06-20 11:06:00 -04:00
parent d6729e3481
commit ed37999f02
1 changed files with 4 additions and 0 deletions

View File

@ -161,6 +161,8 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
if(textBoxArray.get(currentBox).id.contains("game")){ if(textBoxArray.get(currentBox).id.contains("game")){
gameStart = true; gameStart = true;
} }
// always unpause game, no matter what screen is navigated to
GameFrame.game.isPaused = false;
// logic for different screens starts here // logic for different screens starts here
if (textBoxArray.get(currentBox).id.equals("game-start")) { if (textBoxArray.get(currentBox).id.equals("game-start")) {
try { try {
@ -170,6 +172,8 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
GameFrame.game.player.yVelocity = 0; GameFrame.game.player.yVelocity = 0;
GameFrame.game.map = new Tile[1000][18]; GameFrame.game.map = new Tile[1000][18];
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
GameFrame.game.isContinue = true;
textBoxArray.add(continueGame);
GameFrame.game.startThread(); GameFrame.game.startThread();
GameFrame.main.add(GameFrame.game, "game", 0); GameFrame.main.add(GameFrame.game, "game", 0);
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException ex) { } catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException ex) {