Add tip to return from settings

master
John 2022-06-19 19:01:59 -07:00
parent fcf21cd48d
commit f86c6260c7
2 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,8 @@ public class GameFrame extends JFrame{
System.out.println(e);
}
game.startThread();
// save game after load to prevent lag spikes during the game
FileManager.writeObjectToFile("local\\temp_state.dat", game);
/*
try {
// read previously saved controls

View File

@ -26,10 +26,11 @@ public class SettingPanel extends MenuPanel {
public static final int GAME_HEIGHT = 630;
public TextBox title;
public TextBox up, down, left, right;
public TextBox up, down, left, right, tip;
public ArrayList<TextBox> textBoxArray = new ArrayList<TextBox>();
public Font standardFont = new Font(Font.MONOSPACED, Font.BOLD, 60);
public Font smallFont = new Font(Font.MONOSPACED, Font.PLAIN, 40);
public Font smallerFont = new Font(Font.MONOSPACED, Font.ITALIC, 24);
public int playerFrame, enemyFrame;
public boolean waitForKey, notFirstWait;
public int lastKeyCode = -1;
@ -44,9 +45,10 @@ public class SettingPanel extends MenuPanel {
down = new TextBox(350, 600, 50, GAME_WIDTH, smallFont, "Down", Integer.toString(KeyEvent.VK_S));
left = new TextBox(400, 600, 50, GAME_WIDTH, smallFont, "Left", Integer.toString(KeyEvent.VK_A));
right = new TextBox(450, 600, 50, GAME_WIDTH, smallFont, "Right", Integer.toString(KeyEvent.VK_D));
tip = new TextBox(500, 600, 50, GAME_WIDTH, smallerFont, "TIP: Press ESC to return to the main menu", null);
textBoxArray.add(up);
textBoxArray.add(down);
textBoxArray.add(left);
textBoxArray.add(down);
textBoxArray.add(right);
pauseMenu = new PauseMenu(GAME_HEIGHT/2, 0, 400, 400, GAME_WIDTH, smallFont, "Enter your key", true);
@ -68,6 +70,7 @@ public class SettingPanel extends MenuPanel {
t.text = oldText;
}
oldText = textBoxArray.get(currentBox).text;
tip.draw(g, new Color(0, 0, 0, 0), Color.lightGray);
// TODO: clean up
middlewareIndex = GameFrame.game.middlewareArray.indexOf(new Middleware(Integer.parseInt(textBoxArray.get(currentBox).id), -1));
// -2 was chosen as oldCode instead of -1 to prevent conflicts