Merge remote-tracking branch 'origin/master'
commit
cf134e3104
|
@ -412,7 +412,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
double delta = 0;
|
||||
long now;
|
||||
int fireballCounter = 0;
|
||||
while(true){ //this is the infinite game loop
|
||||
while(isRunning){ //this is the infinite game loop
|
||||
now = System.nanoTime();
|
||||
delta = delta + (now-lastTime)/ns;
|
||||
lastTime = now;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class LevelManager implements Serializable {
|
|||
public static String filePath;
|
||||
|
||||
public static int bombs;
|
||||
public static void setLevel(int level){
|
||||
public static void setLevel(int level, boolean hasDied){
|
||||
GameFrame.game.bombs.clear();
|
||||
GameFrame.game.fireballs.clear();
|
||||
GameFrame.game.player.yVelocity = 0;
|
||||
|
@ -38,21 +38,27 @@ public class LevelManager implements Serializable {
|
|||
}
|
||||
try {
|
||||
MapReader.inputMap(filePath);
|
||||
GameFrame.game.dialogueArray = new ArrayList<String>(Arrays.asList(MapReader.inputDialogue(filePath)));
|
||||
if (GameFrame.game.dialogueArray.get(0).contains("$Villain")) {
|
||||
GameFrame.game.dialogueArray.remove(0);
|
||||
GameFrame.game.dialogueMenu.isNarrator = false;
|
||||
// TODO: move img path to GamePanel
|
||||
GameFrame.game.dialogueMenu.PORTRAIT = new BufferedImageWrapper("img\\dialogue\\Bouncer.png");
|
||||
if (!hasDied) {
|
||||
GameFrame.game.dialogueArray = new ArrayList<String>(Arrays.asList(MapReader.inputDialogue(filePath)));
|
||||
if (GameFrame.game.dialogueArray.get(0).contains("$Villain")) {
|
||||
GameFrame.game.dialogueArray.remove(0);
|
||||
GameFrame.game.dialogueMenu.isNarrator = false;
|
||||
// TODO: move img path to GamePanel
|
||||
GameFrame.game.dialogueMenu.PORTRAIT = new BufferedImageWrapper("img\\dialogue\\Bouncer.png");
|
||||
}
|
||||
GameFrame.game.dialogueMenu.currentFrame = 0;
|
||||
GameFrame.game.dialogueMenu.frameCounter = 0;
|
||||
GameFrame.game.isDialogue = true;
|
||||
}
|
||||
GameFrame.game.dialogueMenu.currentFrame = 0;
|
||||
GameFrame.game.dialogueMenu.frameCounter = 0;
|
||||
GameFrame.game.isDialogue = true;
|
||||
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//GamePanel.player.reset();
|
||||
}
|
||||
|
||||
public static void setLevel(int level) {
|
||||
setLevel(level, false);
|
||||
}
|
||||
public static void nextLevel(){
|
||||
setLevel(level+1);
|
||||
}
|
||||
|
|
|
@ -168,6 +168,7 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
|||
GameFrame.game.isRunning = false;
|
||||
GameFrame.game.player.xVelocity = 0;
|
||||
GameFrame.game.player.yVelocity = 0;
|
||||
GameFrame.game.map = new Tile[1000][18];
|
||||
GameFrame.game = new GamePanel(GameFrame.main); //run GamePanel constructor
|
||||
GameFrame.game.startThread();
|
||||
GameFrame.main.add(GameFrame.game, "game", 0);
|
||||
|
|
|
@ -282,7 +282,7 @@ public class Player extends GenericSprite {
|
|||
}
|
||||
|
||||
public void reset(){
|
||||
LevelManager.setLevel(LevelManager.level);
|
||||
LevelManager.setLevel(LevelManager.level, true);
|
||||
GameFrame.game.camera.x = LevelManager.xSpawn;
|
||||
y = LevelManager.ySpawn;
|
||||
holdingSteel = false;
|
||||
|
|
Loading…
Reference in New Issue