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
BIN
assets/landing_platform.png
Normal file
BIN
assets/landing_platform.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 638 B |
BIN
assets/rocket_landing0.png
Normal file
BIN
assets/rocket_landing0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 533 B |
BIN
assets/rocket_landing0.png~
Normal file
BIN
assets/rocket_landing0.png~
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 541 B |
BIN
assets/rocket_landing1.png
Normal file
BIN
assets/rocket_landing1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 638 B |
BIN
assets/rocket_landing1.png~
Normal file
BIN
assets/rocket_landing1.png~
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 650 B |
BIN
assets/rocket_top.png-autosave.kra
Normal file
BIN
assets/rocket_top.png-autosave.kra
Normal file
Binary file not shown.
|
|
@ -34,8 +34,20 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
|
|
||||||
private int mouseX, mouseY;
|
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 planetZX311;
|
||||||
private BufferedImage planetZX311H;
|
private BufferedImage planetZX311H;
|
||||||
|
private BufferedImage landingPlatform;
|
||||||
|
|
||||||
private int hoverYOffset = 0;
|
private int hoverYOffset = 0;
|
||||||
private String hoverDirection = "up"; // this makes the cool floating animation on the main menu
|
private String hoverDirection = "up"; // this makes the cool floating animation on the main menu
|
||||||
private int planetX = 450;
|
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 Rectangle planetCollision = new Rectangle(planetX, planetY, planetSize, planetSize);
|
||||||
private boolean hoveringOverPlanet = false;
|
private boolean hoveringOverPlanet = false;
|
||||||
|
|
||||||
private BufferedImage button;
|
|
||||||
private BufferedImage buttonH;
|
|
||||||
private int playButtonX = 70;
|
private int playButtonX = 70;
|
||||||
private int quitButtonX = 70;
|
private int quitButtonX = 70;
|
||||||
private int playButtonY = 210;
|
private int playButtonY = 210;
|
||||||
|
|
@ -58,11 +69,6 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
private boolean hoveringOverPlayButton = false;
|
private boolean hoveringOverPlayButton = false;
|
||||||
private boolean hoveringOverQuitButton = 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 rocketYPre = windowHeight/2-125;
|
||||||
private int rocketY = windowHeight/2-125;
|
private int rocketY = windowHeight/2-125;
|
||||||
private int rocketExhaustY = rocketY;
|
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"));
|
rocketTop = ImageIO.read(new File("assets/rocket_top.png"));
|
||||||
rocketBottom = ImageIO.read(new File("assets/rocket_bottom.png"));
|
rocketBottom = ImageIO.read(new File("assets/rocket_bottom.png"));
|
||||||
parachute = ImageIO.read(new File("assets/parachute.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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -217,13 +226,25 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
g.fillOval(starX[i] - starSize, starY[i] - starSize, starSize, starSize);
|
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(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);
|
g.drawImage(rocketTop, windowWidth / 2 - 73, rocketY - hoverYOffset / 3 + (detachTimer-321)/5, 147, 84, this);
|
||||||
} else {
|
} 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(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 {
|
} else {
|
||||||
|
|
@ -239,7 +260,6 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
rocketBottomY = rocketY - hoverYOffset / 3 + 64 + (detachTimer - 260) * 2;
|
rocketBottomY = rocketY - hoverYOffset / 3 + 64 + (detachTimer - 260) * 2;
|
||||||
g2.rotate(Math.toRadians((detachTimer-260)/3), rocketBottomX + 147 / 2, rocketBottomY + 171 / 2);
|
g2.rotate(Math.toRadians((detachTimer-260)/3), rocketBottomX + 147 / 2, rocketBottomY + 171 / 2);
|
||||||
g2.drawImage(rocketBottom, rocketBottomX, rocketBottomY, 147, 171, this);
|
g2.drawImage(rocketBottom, rocketBottomX, rocketBottomY, 147, 171, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (levelProgress) {
|
if (levelProgress) {
|
||||||
|
|
@ -255,6 +275,7 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
public void keyPressed(KeyEvent e) { // input
|
public void keyPressed(KeyEvent e) { // input
|
||||||
switch (e.getKeyCode()) {
|
switch (e.getKeyCode()) {
|
||||||
case KeyEvent.VK_ESCAPE -> System.exit(0);
|
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