Prepared some animations, im mainly commiting and pushing this so I can switch over to my linux setup to work on this project
This commit is contained in:
parent
d49011edec
commit
e31439b993
2 changed files with 25 additions and 1 deletions
BIN
assets/rocket.png
Normal file
BIN
assets/rocket.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -29,6 +29,8 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
private Font caveat;
|
||||
|
||||
private int level = 1;
|
||||
private boolean levelProgress = false; // this is used to make the transition from the main menu to the game level look cool
|
||||
private int fadeAnimation = 0;
|
||||
|
||||
private int mouseX, mouseY;
|
||||
|
||||
|
|
@ -159,6 +161,28 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
g.drawString("Quit (pretty lame)", quitButtonX +24, quitButtonY+67);
|
||||
}
|
||||
}
|
||||
|
||||
if (levelProgress && (windowWidth-fadeAnimation)>0) {
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillRect(windowWidth-fadeAnimation, 0, windowWidth, windowHeight);
|
||||
fadeAnimation += 20;
|
||||
}
|
||||
else if (levelProgress && (windowWidth-fadeAnimation)<=0) { level = 2; }
|
||||
}
|
||||
if (level == 2) {
|
||||
g.setColor(Color.WHITE);
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < MENU_STAR_COUNT; i++) { // drawing the stars
|
||||
starSize = rand.nextInt(1,8);
|
||||
g.fillOval(starX[i]-starSize, starY[i]-starSize, starSize, starSize);
|
||||
}
|
||||
|
||||
if (levelProgress) {
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillRect(windowWidth-fadeAnimation, 0, windowWidth, windowHeight);
|
||||
fadeAnimation += 20;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +232,7 @@ public class Game extends JPanel implements ActionListener, KeyListener {
|
|||
if (e.getButton() == MouseEvent.BUTTON1 && hoveringOverPlayButton) {
|
||||
playButtonX = playButtonX + 5;
|
||||
playButtonY = playButtonY - 5;
|
||||
level = 2;
|
||||
levelProgress = true;
|
||||
}
|
||||
if (e.getButton() == MouseEvent.BUTTON1 && hoveringOverPlanet) {
|
||||
planetX = planetX+5;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue