diff --git a/assets/rocket.png b/assets/rocket.png new file mode 100644 index 0000000..e54f7dc Binary files /dev/null and b/assets/rocket.png differ diff --git a/src/main/java/dev/dvorakmortonxd/Game.java b/src/main/java/dev/dvorakmortonxd/Game.java index ed50a9b..bc05b17 100644 --- a/src/main/java/dev/dvorakmortonxd/Game.java +++ b/src/main/java/dev/dvorakmortonxd/Game.java @@ -29,6 +29,8 @@ public class Game extends JPanel implements ActionListener, KeyListener { private Font caveat; private int level = 1; + private boolean levelProgress = false; // this is used to make the transition from the main menu to the game level look cool + private int fadeAnimation = 0; private int mouseX, mouseY; @@ -159,6 +161,28 @@ public class Game extends JPanel implements ActionListener, KeyListener { g.drawString("Quit (pretty lame)", quitButtonX +24, quitButtonY+67); } } + + if (levelProgress && (windowWidth-fadeAnimation)>0) { + g.setColor(Color.BLACK); + g.fillRect(windowWidth-fadeAnimation, 0, windowWidth, windowHeight); + fadeAnimation += 20; + } + else if (levelProgress && (windowWidth-fadeAnimation)<=0) { level = 2; } + } + if (level == 2) { + g.setColor(Color.WHITE); + Random rand = new Random(); + for (int i = 0; i < MENU_STAR_COUNT; i++) { // drawing the stars + starSize = rand.nextInt(1,8); + g.fillOval(starX[i]-starSize, starY[i]-starSize, starSize, starSize); + } + + if (levelProgress) { + g.setColor(Color.BLACK); + g.fillRect(windowWidth-fadeAnimation, 0, windowWidth, windowHeight); + fadeAnimation += 20; + } + } } @@ -208,7 +232,7 @@ public class Game extends JPanel implements ActionListener, KeyListener { if (e.getButton() == MouseEvent.BUTTON1 && hoveringOverPlayButton) { playButtonX = playButtonX + 5; playButtonY = playButtonY - 5; - level = 2; + levelProgress = true; } if (e.getButton() == MouseEvent.BUTTON1 && hoveringOverPlanet) { planetX = planetX+5;