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