diff --git a/assets/rocket_top.png-autosave.kra b/assets/rocket_top.png-autosave.kra deleted file mode 100644 index 2a0d7ba..0000000 Binary files a/assets/rocket_top.png-autosave.kra and /dev/null differ diff --git a/assets/sun.png b/assets/sun.png new file mode 100644 index 0000000..9b6541b Binary files /dev/null and b/assets/sun.png differ diff --git a/src/main/java/dev/dvorakmortonxd/Game.java b/src/main/java/dev/dvorakmortonxd/Game.java index a59d0d4..ebce1c5 100644 --- a/src/main/java/dev/dvorakmortonxd/Game.java +++ b/src/main/java/dev/dvorakmortonxd/Game.java @@ -34,7 +34,7 @@ public class Game extends JPanel implements ActionListener, KeyListener { private int mouseX, mouseY; - //defineds all the image assets used + // predefines all the image assets used private BufferedImage rocket; private BufferedImage rocketTop; private BufferedImage rocketBottom; @@ -47,6 +47,7 @@ public class Game extends JPanel implements ActionListener, KeyListener { private BufferedImage planetZX311; private BufferedImage planetZX311H; private BufferedImage landingPlatform; + private BufferedImage sun; private int hoverYOffset = 0; private String hoverDirection = "up"; // this makes the cool floating animation on the main menu @@ -108,6 +109,7 @@ public class Game extends JPanel implements ActionListener, KeyListener { landingPlatform = ImageIO.read(new File("assets/landing_platform.png")); rocketLanding0 = ImageIO.read(new File("assets/rocket_landing0.png")); rocketLanding1 = ImageIO.read(new File("assets/rocket_landing1.png")); + sun = ImageIO.read(new File("assets/sun.png")); } catch (IOException e) { e.printStackTrace(); } @@ -214,10 +216,10 @@ public class Game extends JPanel implements ActionListener, KeyListener { g.drawImage(rocket, windowWidth / 2 - 73, rocketY, 147, 234, this); } else { if (detachTimer > 320) { - if ((detachTimer-320) / 6 <= 255) { - g.setColor(new Color(0 + (detachTimer - 320) / 20, 0 + (detachTimer - 320) / 20, 0 + (detachTimer - 320) / 6)); + if ((detachTimer-320) / 4 <= 255) { + g.setColor(new Color((detachTimer - 320) / 8, (detachTimer - 320) / 8, (detachTimer - 320) / 4)); } else { - g.setColor(new Color(76,76,255)); + g.setColor(new Color(127, 127,255)); } g.fillRect(0,0,windowWidth,windowHeight); if (detachTimer < 1000) { @@ -230,21 +232,26 @@ public class Game extends JPanel implements ActionListener, KeyListener { g.drawImage(parachute, windowWidth / 2 - 73, rocketY - hoverYOffset / 3 - 42 + (detachTimer-321)/5, 147, 90, this); g.drawImage(rocketTop, windowWidth / 2 - 73, rocketY - hoverYOffset / 3 + (detachTimer-321)/5, 147, 84, this); } else { + + if (detachTimer < 1200) { + g.drawImage(rocketTop, windowWidth / 2 - 73, 300, 147, 84, this); + g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this); + } else if (1400 > detachTimer && detachTimer >= 1200) { + g.drawImage(rocketLanding0, windowWidth / 2 - 73, 300, 147, 111, this); + g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this); + } else if (1400 <= detachTimer && detachTimer < 1700) {; + g.drawImage(parachute, windowWidth / 2 - 73, 258+(detachTimer-1400)/3*2, 147, 90, this); + g.drawImage(rocketLanding1, windowWidth / 2 - 73, 300, 147, 111, this); + } else { + level = 3; + } + // (windowHeight-210) is the desired height if ((1100-(detachTimer / 2 )) >= 340) { g.drawImage(landingPlatform, 0, 1100-(detachTimer/2), windowWidth, windowWidth/128*30, this); } else { g.drawImage(landingPlatform, 0, 340, windowWidth, windowWidth/128*30, this); } - g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this); - - if (detachTimer <= 1200) { - g.drawImage(rocketTop, windowWidth / 2 - 73, 300, 147, 84, this); - } else if (1400 > detachTimer && detachTimer > 1200) { - g.drawImage(rocketLanding0, windowWidth / 2 - 73, 300, 147, 111, this); - } else { - g.drawImage(rocketLanding1, windowWidth / 2 - 73, 300, 147, 111, this); - } } } else { @@ -268,6 +275,16 @@ public class Game extends JPanel implements ActionListener, KeyListener { fadeAnimation += 20; } } + if (level == 3) { + g.setColor(new Color(127, 127,255)); + g.fillRect(0,0,windowWidth,windowHeight); + Graphics2D g2 = (Graphics2D) g; + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacityAnimation)); + g2.drawImage(sun, 600, -80, 384, 384, this); + g2.setComposite(AlphaComposite.SrcOver); // reset so nothing else is transparent + g.drawImage(landingPlatform, 0, 340, windowWidth, windowWidth/128*30, this); + g.drawImage(rocketLanding1, windowWidth / 2 - 73, 300, 147, 111, this); + } Toolkit.getDefaultToolkit().sync(); } @@ -275,7 +292,6 @@ public class Game extends JPanel implements ActionListener, KeyListener { public void keyPressed(KeyEvent e) { // input switch (e.getKeyCode()) { case KeyEvent.VK_ESCAPE -> System.exit(0); - case KeyEvent.VK_SPACE -> System.out.println(1100-(detachTimer/2)); } }