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:
dvorakmortonxd 2026-10-19 21:54:51 +02:00
commit e31439b993
2 changed files with 25 additions and 1 deletions

View file

@ -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;