added the sun into the level 2
This commit is contained in:
parent
8532599acb
commit
784ef65ec9
1 changed files with 18 additions and 2 deletions
|
|
@ -134,13 +134,13 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
hoveringOverQuitButton = quitButtonCollision.contains(mouseX, mouseY);
|
hoveringOverQuitButton = quitButtonCollision.contains(mouseX, mouseY);
|
||||||
if (hoverDirection == "up") {
|
if (hoverDirection == "up") {
|
||||||
hoverYOffset++;
|
hoverYOffset++;
|
||||||
opacityAnimation += 0.01;
|
if (opacityAnimation < 1.00f) { opacityAnimation += 0.01f; }
|
||||||
if (hoverYOffset > 90) {
|
if (hoverYOffset > 90) {
|
||||||
hoverDirection = "down";
|
hoverDirection = "down";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverYOffset--;
|
hoverYOffset--;
|
||||||
opacityAnimation -= 0.01;
|
if (opacityAnimation > 0.01f) { opacityAnimation -= 0.01f; }
|
||||||
if (hoverYOffset <= 0) {
|
if (hoverYOffset <= 0) {
|
||||||
hoverDirection = "up";
|
hoverDirection = "up";
|
||||||
}
|
}
|
||||||
|
|
@ -234,12 +234,28 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (detachTimer < 1200) {
|
if (detachTimer < 1200) {
|
||||||
|
opacityAnimation = 0.01f;
|
||||||
|
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(rocketTop, windowWidth / 2 - 73, 300, 147, 84, this);
|
g.drawImage(rocketTop, windowWidth / 2 - 73, 300, 147, 84, this);
|
||||||
g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this);
|
g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this);
|
||||||
} else if (1400 > detachTimer && detachTimer >= 1200) {
|
} else if (1400 > detachTimer && detachTimer >= 1200) {
|
||||||
|
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(rocketLanding0, windowWidth / 2 - 73, 300, 147, 111, this);
|
g.drawImage(rocketLanding0, windowWidth / 2 - 73, 300, 147, 111, this);
|
||||||
g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this);
|
g.drawImage(parachute, windowWidth / 2 - 73, 258, 147, 90, this);
|
||||||
} else if (1400 <= detachTimer && detachTimer < 1700) {;
|
} else if (1400 <= detachTimer && detachTimer < 1700) {;
|
||||||
|
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(parachute, windowWidth / 2 - 73, 258+(detachTimer-1400)/3*2, 147, 90, this);
|
g.drawImage(parachute, windowWidth / 2 - 73, 258+(detachTimer-1400)/3*2, 147, 90, this);
|
||||||
g.drawImage(rocketLanding1, windowWidth / 2 - 73, 300, 147, 111, this);
|
g.drawImage(rocketLanding1, windowWidth / 2 - 73, 300, 147, 111, this);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue