Finished the parachute animation, just need to work on the landing terrain and other stuff now, gonna go to sleep now finally
This commit is contained in:
parent
bd1faa2f5e
commit
6800bdbd79
1 changed files with 39 additions and 9 deletions
|
|
@ -62,6 +62,7 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
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;
|
||||
|
|
@ -97,6 +98,7 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
rocketExhaust = ImageIO.read(new File("assets/rocket_exhaust.png"));
|
||||
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"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -191,25 +193,53 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
else if (levelProgress && (windowWidth-fadeAnimation)<=0) { level = 2; }
|
||||
}
|
||||
if (level == 2) {
|
||||
g.setColor(Color.WHITE);
|
||||
for (int i = 0; i < MENU_STAR_COUNT; i++) { // drawing the stars
|
||||
if (detachTimer < 260) {
|
||||
g.setColor(Color.GRAY);
|
||||
for (int i = 0; i < 16; i++) { // drawing the stars
|
||||
g.fillOval(starX[i]-starSize, starY[i]-starSize, starSize, starSize);
|
||||
}
|
||||
|
||||
if (detachTimer < 240) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacityAnimation));
|
||||
g2.drawImage(rocketExhaust, windowWidth / 2 - 25, rocketExhaustY, 50, 100, this);
|
||||
g2.setComposite(AlphaComposite.SrcOver); // reset so nothing else is transparent
|
||||
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));
|
||||
} else {
|
||||
g.setColor(new Color(76,76,255));
|
||||
}
|
||||
g.fillRect(0,0,windowWidth,windowHeight);
|
||||
if (detachTimer < 1000) {
|
||||
g.setColor(Color.GRAY);
|
||||
for (int i = 0; i < 16; i++) { // drawing the stars
|
||||
g.fillOval(starX[i] - starSize, starY[i] - starSize, starSize, starSize);
|
||||
}
|
||||
}
|
||||
if ((rocketY - hoverYOffset / 3 + (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 {
|
||||
g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this);
|
||||
g.drawImage(rocketTop, windowWidth / 2 - 73, 300, 147, 84, this);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
g.setColor(Color.GRAY);
|
||||
for (int i = 0; i < 16; i++) { // drawing the stars
|
||||
g.fillOval(starX[i]-starSize, starY[i]-starSize, starSize, starSize);
|
||||
}
|
||||
g.drawImage(rocketTop, windowWidth / 2 - 73, rocketY - hoverYOffset / 3, 147, 84, this);
|
||||
}
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
rocketBottomX = windowWidth / 2 - 73;
|
||||
rocketBottomY = rocketY - hoverYOffset / 3 + 64 + (detachTimer - 240) * 2;
|
||||
g2.rotate(Math.toRadians((detachTimer-240)/3), rocketBottomX + 147 / 2, rocketBottomY + 171 / 2);
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue