added a dissassembling animation of the rocket
This commit is contained in:
parent
6800bdbd79
commit
43e6fc59d6
7 changed files with 31 additions and 10 deletions
|
|
@ -34,8 +34,20 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
|
||||
private int mouseX, mouseY;
|
||||
|
||||
//defineds all the image assets used
|
||||
private BufferedImage rocket;
|
||||
private BufferedImage rocketTop;
|
||||
private BufferedImage rocketBottom;
|
||||
private BufferedImage rocketLanding0;
|
||||
private BufferedImage rocketLanding1;
|
||||
private BufferedImage rocketExhaust;
|
||||
private BufferedImage parachute;
|
||||
private BufferedImage button;
|
||||
private BufferedImage buttonH;
|
||||
private BufferedImage planetZX311;
|
||||
private BufferedImage planetZX311H;
|
||||
private BufferedImage landingPlatform;
|
||||
|
||||
private int hoverYOffset = 0;
|
||||
private String hoverDirection = "up"; // this makes the cool floating animation on the main menu
|
||||
private int planetX = 450;
|
||||
|
|
@ -45,8 +57,7 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
private Rectangle planetCollision = new Rectangle(planetX, planetY, planetSize, planetSize);
|
||||
private boolean hoveringOverPlanet = false;
|
||||
|
||||
private BufferedImage button;
|
||||
private BufferedImage buttonH;
|
||||
|
||||
private int playButtonX = 70;
|
||||
private int quitButtonX = 70;
|
||||
private int playButtonY = 210;
|
||||
|
|
@ -58,11 +69,6 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
private boolean hoveringOverPlayButton = false;
|
||||
private boolean hoveringOverQuitButton = false;
|
||||
|
||||
private BufferedImage rocket;
|
||||
private BufferedImage rocketTop;
|
||||
private BufferedImage rocketBottom;
|
||||
private BufferedImage rocketExhaust;
|
||||
private BufferedImage parachute;
|
||||
private int rocketYPre = windowHeight/2-125;
|
||||
private int rocketY = windowHeight/2-125;
|
||||
private int rocketExhaustY = rocketY;
|
||||
|
|
@ -99,6 +105,9 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
rocketTop = ImageIO.read(new File("assets/rocket_top.png"));
|
||||
rocketBottom = ImageIO.read(new File("assets/rocket_bottom.png"));
|
||||
parachute = ImageIO.read(new File("assets/parachute.png"));
|
||||
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"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -217,13 +226,25 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
g.fillOval(starX[i] - starSize, starY[i] - starSize, starSize, starSize);
|
||||
}
|
||||
}
|
||||
if ((rocketY - hoverYOffset / 3 + (detachTimer-321)/5) <= 300){
|
||||
if ((rocketYPre + (detachTimer-321)/5) <= 300){
|
||||
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 {
|
||||
// (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);
|
||||
g.drawImage(rocketTop, windowWidth / 2 - 73, 300, 147, 84, 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 {
|
||||
|
|
@ -239,7 +260,6 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
rocketBottomY = rocketY - hoverYOffset / 3 + 64 + (detachTimer - 260) * 2;
|
||||
g2.rotate(Math.toRadians((detachTimer-260)/3), rocketBottomX + 147 / 2, rocketBottomY + 171 / 2);
|
||||
g2.drawImage(rocketBottom, rocketBottomX, rocketBottomY, 147, 171, this);
|
||||
|
||||
}
|
||||
|
||||
if (levelProgress) {
|
||||
|
|
@ -255,6 +275,7 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue