commit
267fb5308b
|
@ -81,6 +81,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
||||||
public BufferedImageWrapper villainPortrait = new BufferedImageWrapper(("img/dialogue/Bouncer.png"));
|
public BufferedImageWrapper villainPortrait = new BufferedImageWrapper(("img/dialogue/Bouncer.png"));
|
||||||
public String lastText;
|
public String lastText;
|
||||||
public boolean isContinue;
|
public boolean isContinue;
|
||||||
|
public boolean isRunning;
|
||||||
|
|
||||||
|
|
||||||
public GamePanel(JPanel gameFrame) throws IOException, SpriteException, UnsupportedAudioFileException, LineUnavailableException {
|
public GamePanel(JPanel gameFrame) throws IOException, SpriteException, UnsupportedAudioFileException, LineUnavailableException {
|
||||||
|
@ -143,6 +144,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
||||||
addUserInterface();
|
addUserInterface();
|
||||||
this.setPreferredSize(new Dimension(GAME_WIDTH, GAME_HEIGHT));
|
this.setPreferredSize(new Dimension(GAME_WIDTH, GAME_HEIGHT));
|
||||||
isNewStart = true;
|
isNewStart = true;
|
||||||
|
isRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUserInterface() {
|
public void addUserInterface() {
|
||||||
|
@ -432,6 +434,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
||||||
delta--;
|
delta--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println(Thread.currentThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEnemy(){
|
public void updateEnemy(){
|
||||||
|
|
|
@ -163,11 +163,14 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
||||||
// 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 {
|
||||||
|
GameFrame.main.remove(GameFrame.game);
|
||||||
|
GameFrame.game.isRunning = false;
|
||||||
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
|
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
|
||||||
|
GameFrame.game.startThread();
|
||||||
|
GameFrame.main.add(GameFrame.game, "game", 0);
|
||||||
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException ex) {
|
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
GameFrame.game.startThread();
|
|
||||||
((CardLayout)gameFrame.getLayout()).show(gameFrame, "game");
|
((CardLayout)gameFrame.getLayout()).show(gameFrame, "game");
|
||||||
} else {
|
} else {
|
||||||
((CardLayout) gameFrame.getLayout()).show(gameFrame, textBoxArray.get(currentBox).id);
|
((CardLayout) gameFrame.getLayout()).show(gameFrame, textBoxArray.get(currentBox).id);
|
||||||
|
|
Loading…
Reference in New Issue