Merge remote-tracking branch 'origin/master'
commit
7ee87d65eb
|
@ -0,0 +1,2 @@
|
|||
Have you heard of the tragedy of
|
||||
Darth Charlie the Wise?
|
|
@ -0,0 +1,2 @@
|
|||
Have you heard of the tragedy of
|
||||
Darth Charlie the Wise?
|
|
@ -0,0 +1,20 @@
|
|||
$Villain
|
||||
I am having a seizure.
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
|
|
@ -18,12 +18,16 @@ public class DialogueMenu extends TextBox implements Serializable {
|
|||
public DialogueMenu(int y, int yHeight, Font font, BufferedImageWrapper portrait, boolean isNarrator) {
|
||||
super(y, GamePanel.GAME_WIDTH - PORTRAIT_WIDTH - PADDING*3, yHeight, 0, font, null, null);
|
||||
PORTRAIT = portrait;
|
||||
checkForNarrator();
|
||||
this.isNarrator = isNarrator;
|
||||
}
|
||||
|
||||
public void checkForNarrator() {
|
||||
if (isNarrator) {
|
||||
newX = PORTRAIT_WIDTH + PADDING*2;
|
||||
} else {
|
||||
newX = PADDING;
|
||||
}
|
||||
this.isNarrator = isNarrator;
|
||||
}
|
||||
|
||||
public void drawCenteredTextBox(Graphics g, String text, Color backgroundColor, Color textColor) {
|
||||
|
@ -72,6 +76,7 @@ public class DialogueMenu extends TextBox implements Serializable {
|
|||
}
|
||||
|
||||
public boolean draw(Graphics g, String text, Color backgroundColor, Color textColor) {
|
||||
checkForNarrator();
|
||||
if (frameCounter >= FREQUENCY) {
|
||||
frameCounter -= FREQUENCY;
|
||||
currentFrame += 1;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import javax.imageio.ImageIO;
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LevelManager implements Serializable {
|
||||
public static int level = 1;
|
||||
|
@ -34,6 +37,16 @@ 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");
|
||||
}
|
||||
GameFrame.game.dialogueMenu.currentFrame = 0;
|
||||
GameFrame.game.dialogueMenu.frameCounter = 0;
|
||||
GameFrame.game.isDialogue = true;
|
||||
} catch (IOException | SpriteException | UnsupportedAudioFileException | LineUnavailableException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -109,6 +109,12 @@ public class MapReader implements Serializable {
|
|||
x+=1;
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] inputDialogue(String mapFilePath) throws IOException {
|
||||
String filePath = mapFilePath.replace(".txt", "-dialogue.txt");
|
||||
return FileManager.readFile(filePath).split("\n");
|
||||
}
|
||||
|
||||
public static void newTile(String filePath) throws IOException, SpriteException {
|
||||
GameFrame.game.map[x][y]=(new SingleTile(TileX,TileY, new BufferedImageWrapper((filePath))));
|
||||
}
|
||||
|
|
|
@ -166,6 +166,8 @@ public class MenuPanel extends JPanel implements Runnable, KeyListener{
|
|||
try {
|
||||
GameFrame.main.remove(GameFrame.game);
|
||||
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.startThread();
|
||||
GameFrame.main.add(GameFrame.game, "game", 0);
|
||||
|
|
Loading…
Reference in New Issue