added something like a custom readme page when you click the planet on the main menu

This commit is contained in:
Martin Dvořák 2026-10-23 18:15:17 +02:00
commit c3a2bb55c5
4 changed files with 34 additions and 5 deletions

View file

@ -3,7 +3,7 @@ plugins {
}
group = "dev.dvorakmortonxd"
version = "0.0.3a"
version = "0.0.4a"
repositories {
mavenCentral()

View file

@ -171,5 +171,6 @@ public class Game extends JPanel implements ActionListener {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // makes the X button on the title bar functional
frame.setLocationRelativeTo(null); // centers the window on the screen
frame.setVisible(true); // makes the window visible
frame.setIconImage(rocket);
}
}

View file

@ -29,7 +29,7 @@ public class input implements KeyListener {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE -> System.exit(0);
case KeyEvent.VK_CONTROL -> System.out.println("X+Y="+m.playerX+"+"+m.playerY);
// THE LINE BELOW IS FOR ME WHEN DEBUGGING, I LEFT IT IN BECAUSE ITS IMPOSSIBLE TO KNOW ABOUT IT WITHOUT READING THE CODE LOL
// THE LINE BELOW IS FOR ME WHEN DEBUGGING, I LEFT IT IN BECAUSE IT'S IMPOSSIBLE TO KNOW ABOUT IT WITHOUT READING THE CODE LOL
case KeyEvent.VK_TAB -> m.timer = new Timer(16, m); // slows back the game animations (62fps)
case KeyEvent.VK_SLASH -> {
m.level = 3;
@ -43,6 +43,9 @@ public class input implements KeyListener {
@Override
public void keyReleased(KeyEvent e) { // what happens when you let go of a key
if (m.level == 0) {
m.level = 1;
}
if (m.playerActive) {
switch (e.getKeyCode()) {
case KeyEvent.VK_W, KeyEvent.VK_UP -> m.upHeld = false;
@ -86,7 +89,10 @@ public class input implements KeyListener {
m.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (m.level == 1) {
if (m.level == 0) {
m.level = 1;
}
else if (m.level == 1) {
if (e.getButton() == MouseEvent.BUTTON1 && m.hoveringOverQuitButton) {
m.quitButtonX = m.quitButtonX + 5;
m.quitButtonY = m.quitButtonY - 5;
@ -100,6 +106,7 @@ public class input implements KeyListener {
if (e.getButton() == MouseEvent.BUTTON1 && m.hoveringOverPlanet) {
m.planetX = m.planetX + 2;
m.planetYPre = m.planetYPre - 2;
m.level = 0;
}
}
}

View file

@ -111,7 +111,28 @@ public class update {
m.repaint();
}
static void paint(Game m, Graphics g) {
if (m.level == 1) {
if (m.level == 0) {
g.setColor(Color.BLACK);
g.fillRect(0,0,m.windowWidth,m.windowHeight);
g.setColor(Color.WHITE);
g.setFont(m.caveat.deriveFont(Font.BOLD, 60f));
g.drawString("Hey! You discovered my hidden page!", 20, m.windowHeight/2-215);
g.setFont(m.caveat.deriveFont(Font.BOLD, 31f));
g.drawString("this is my game project made in Java, it's actually my first game written", 20, m.windowHeight/2-200+35);
g.drawString("entirely in java, I built it using the Swing library, my only previous", 20, m.windowHeight/2-200+70);
g.drawString("experience was with pygame, the biggest advantage to switching to Swing", 20, m.windowHeight/2-200+105);
g.drawString("and java is that, this game actually uses your GPU instead of just CPU!", 20, m.windowHeight/2-200+140);
g.drawString("meaning you could squeeze in more cool effects than you could in pygame!", 20, m.windowHeight/2-200+175);
g.drawString("I plan to finish this project, I've always found space to be really cool", 20, m.windowHeight/2-200+210);
g.drawString("and I just didn't find the games about space that are out right now to be", 20, m.windowHeight/2-200+245);
g.drawString("as entertaining as I wished, the closest thing was Ad Astra/Galacticraft", 20, m.windowHeight/2-200+280);
g.drawString("modpacks in minecraft. I hope you enjoy this game it took me really long", 20, m.windowHeight/2-200+315);
g.drawString("time (as im typing this I have 19 hours, and it isnt even close to being", 20, m.windowHeight/2-200+350);
g.drawString("finished, for context right now I only finished the animations for the", 20, m.windowHeight/2-200+385);
g.drawString("main menu and rocket landing, and the player sprites, that just isn't", 20, m.windowHeight/2-200+420);
g.drawString("enough for a playable experience right now but i'll keep working on it!", 20, m.windowHeight/2-200+455);
}
else if (m.level == 1) {
g.setColor(Color.WHITE);
for (int i = 0; i < m.MENU_STAR_COUNT; i++) { // drawing the stars
g.fillOval(m.starX[i]-m.starSize, m.starY[i]-m.starSize, m.starSize, m.starSize);