Possibly fix bug

master
John 2022-06-19 12:54:59 -07:00
parent 80e5b90603
commit e194a2f290
1 changed files with 2 additions and 0 deletions

View File

@ -165,6 +165,8 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
try { try {
GameFrame.main.remove(GameFrame.game); GameFrame.main.remove(GameFrame.game);
GameFrame.game.isRunning = false; GameFrame.game.isRunning = false;
GameFrame.game.player.xVelocity = 0;
GameFrame.game.player.yVelocity = 0;
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
GameFrame.game.startThread(); GameFrame.game.startThread();
GameFrame.main.add(GameFrame.game, "game", 0); GameFrame.main.add(GameFrame.game, "game", 0);