From 4865b7a023ce3b0243157a6d9aa19f408195144a Mon Sep 17 00:00:00 2001 From: woobin Date: Sat, 25 Nov 2023 18:17:28 +0900 Subject: [PATCH 1/2] make basis of infiniteMode --- src/engine/Core.java | 67 ++++++++++++++++++++++++++++--------- src/engine/DrawManager.java | 9 +++-- 2 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/engine/Core.java b/src/engine/Core.java index 8efada80..40b40934 100644 --- a/src/engine/Core.java +++ b/src/engine/Core.java @@ -50,6 +50,8 @@ public final class Core { */ private static int difficulty = 1; + public static boolean checkInfinity = false ; + /** * Difficulty settings for level 1. */ @@ -216,6 +218,7 @@ public static void main(final String[] args) { gameSettings.add(SETTINGS_LEVEL_6); gameSettings.add(SETTINGS_LEVEL_7); gameSettings.add(SETTINGS_LEVEL_8); + gameSettings.add(SETTINGS_LEVEL_1); } @@ -227,6 +230,11 @@ public static void main(final String[] args) { LOGGER.info("Go Difficulty Select"); break; } + if (stage == 9) + checkInfinity = true; + else + checkInfinity = false; + LOGGER.info("Closing Level screen."); gameState.setLevel(stage); @@ -234,10 +242,21 @@ public static void main(final String[] args) { // Game & score. do { - currentScreen = new GameScreen(gameState, - gameSettings.get(gameState.getLevel() - 1), - enhanceManager, itemManager, - width, height, FPS); + if (gameState.getLevel() == NUM_LEVELS + 1) { + gameState.setLevel(1); + currentScreen = new GameScreen(gameState, + gameSettings.get(gameState.getLevel() - 1), + enhanceManager, itemManager, + width, height, FPS); + } + + else { + currentScreen = new GameScreen(gameState, + gameSettings.get(gameState.getLevel() - 1), + enhanceManager, itemManager, + width, height, FPS); + } + LOGGER.info("Starting " + WIDTH + "x" + HEIGHT + " game screen at " + FPS + " fps."); returnCode = frame.setScreen(currentScreen); @@ -246,18 +265,34 @@ public static void main(final String[] args) { gameState = ((GameScreen) currentScreen).getGameState(); BulletsRemaining = gameState.getBulletsRemaining(); - gameState = new GameState(gameState.getLevel() + 1, - gameState.getScore(), - gameState.getCoin(), - gameState.getLivesRemaining(), - gameState.getBulletsShot(), - gameState.getShipsDestroyed(), - gameState.getHardCore(), - gameState.getShipColor(), - gameState.getNowSkinString(), - gameState.getOwnedSkins(), - gameState.getEquippedSkins(), - 99); + if (gameState.getLevel() == NUM_LEVELS && checkInfinity) { + gameState = new GameState(1, + gameState.getScore(), + gameState.getCoin(), + gameState.getLivesRemaining(), + gameState.getBulletsShot(), + gameState.getShipsDestroyed(), + gameState.getHardCore(), + gameState.getShipColor(), + gameState.getNowSkinString(), + gameState.getOwnedSkins(), + gameState.getEquippedSkins(), + 99); + } + else { + gameState = new GameState(gameState.getLevel() + 1, + gameState.getScore(), + gameState.getCoin(), + gameState.getLivesRemaining(), + gameState.getBulletsShot(), + gameState.getShipsDestroyed(), + gameState.getHardCore(), + gameState.getShipColor(), + gameState.getNowSkinString(), + gameState.getOwnedSkins(), + gameState.getEquippedSkins(), + 99); + } // SubMenu | Item Store & Enhancement & Continue & Skin Store do{ diff --git a/src/engine/DrawManager.java b/src/engine/DrawManager.java index 858dfe17..248ae14d 100644 --- a/src/engine/DrawManager.java +++ b/src/engine/DrawManager.java @@ -1480,8 +1480,13 @@ public void drawStageSelect(final Screen screen, final int option, final int sta drawCenteredRegularString(screen, SelectString_2,screen.getHeight() / 8 + screen.getHeight() / 16); String[] Stage = new String[stages]; backBufferGraphics.setFont(fontBig); - for (int i = 0; i < stages; i++) { - Stage[i] = String.valueOf(i+1); + for (int i = 0; i < stages ; i++) { + if (i != stages - 1) + Stage[i] = String.valueOf(i+1); + else { + backBufferGraphics.setFont(fontRegular); + Stage[i] = "inf"; + } if (option == i) backBufferGraphics.setColor(blinkingColor("GREEN")); else From 72dddb1c669785a3b67b97a70ae9fcb8fb46a8e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Nov 2023 23:47:36 +0900 Subject: [PATCH 2/2] 2p infinite mode --- src/engine/Core.java | 65 ++++++++++++++++++++++++++++--------- src/engine/SoundEffect.java | 2 +- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/engine/Core.java b/src/engine/Core.java index 40b40934..4843a92e 100644 --- a/src/engine/Core.java +++ b/src/engine/Core.java @@ -190,7 +190,7 @@ public static void main(final String[] args) { break; case 2: - currentScreen = new SelectScreen(width, height, FPS, 0); // Difficulty Selection + currentScreen = new SelectScreen(width, height, FPS, 0); // Dfficulty Selection LOGGER.info("Select Difficulty"); difficulty = frame.setScreen(currentScreen); if (difficulty == 4) { @@ -547,6 +547,7 @@ else if(scorescreen == 32) gameSettings.add(SETTINGS_LEVEL_6); gameSettings.add(SETTINGS_LEVEL_7); gameSettings.add(SETTINGS_LEVEL_8); + gameSettings.add(SETTINGS_LEVEL_1); } LOGGER.info("select Level"); // Stage(Level) Selection @@ -558,6 +559,12 @@ else if(scorescreen == 32) LOGGER.info("Go Difficulty Select"); break; } + + if (stage == 9) + checkInfinity = true; + else + checkInfinity = false; + LOGGER.info("Closing Level screen."); gameState_2P.setLevel(stage); @@ -565,10 +572,20 @@ else if(scorescreen == 32) // Game & score. do { - currentScreen = new GameScreen_2P(gameState_2P, - gameSettings.get(gameState_2P.getLevel() - 1), - enhanceManager, itemManager, - width, height, FPS); + if (gameState_2P.getLevel() == NUM_LEVELS + 1) { + gameState_2P.setLevel(1); + currentScreen = new GameScreen_2P(gameState_2P, + gameSettings.get(gameState_2P.getLevel() - 1), + enhanceManager, itemManager, + width, height, FPS); + } + + else { + currentScreen = new GameScreen_2P(gameState_2P, + gameSettings.get(gameState_2P.getLevel() - 1), + enhanceManager, itemManager, + width, height, FPS); + } LOGGER.info("Starting " + WIDTH + "x" + HEIGHT + " game screen at " + FPS + " fps."); returnCode = frame.setScreen(currentScreen); @@ -578,17 +595,33 @@ else if(scorescreen == 32) BulletsRemaining_1p = gameState_2P.getBulletsRemaining_1p(); BulletsRemaining_2p = gameState_2P.getBulletsRemaining_2p(); - gameState_2P = new GameState_2P(gameState_2P.getLevel() + 1, - gameState_2P.getScore_1P(), - gameState_2P.getScore_2P(), - gameState_2P.getCoin(), - gameState_2P.getLivesRemaining_1P(), - gameState_2P.getLivesRemaining_2P(), - gameState_2P.getBulletsShot_1P(), - gameState_2P.getBulletsShot_2P(), - gameState_2P.getShipsDestroyed(), - gameState_2P.getHardCore(), - 50, 50); + if (gameState_2P.getLevel() == NUM_LEVELS && checkInfinity) { + gameState_2P = new GameState_2P(1, + gameState_2P.getScore_1P(), + gameState_2P.getScore_2P(), + gameState_2P.getCoin(), + gameState_2P.getLivesRemaining_1P(), + gameState_2P.getLivesRemaining_2P(), + gameState_2P.getBulletsShot_1P(), + gameState_2P.getBulletsShot_2P(), + gameState_2P.getShipsDestroyed(), + gameState_2P.getHardCore(), + 50, 50); + } + else { + gameState_2P = new GameState_2P(1, + gameState_2P.getScore_1P(), + gameState_2P.getScore_2P(), + gameState_2P.getCoin(), + gameState_2P.getLivesRemaining_1P(), + gameState_2P.getLivesRemaining_2P(), + gameState_2P.getBulletsShot_1P(), + gameState_2P.getBulletsShot_2P(), + gameState_2P.getShipsDestroyed(), + gameState_2P.getHardCore(), + 50, 50); + } + // SubMenu | Item Store & Enhancement & Continue & Skin Store do{ diff --git a/src/engine/SoundEffect.java b/src/engine/SoundEffect.java index 03c2408d..b963ef75 100644 --- a/src/engine/SoundEffect.java +++ b/src/engine/SoundEffect.java @@ -8,7 +8,7 @@ import java.util.Timer; -public class SoundEffect { +public class SoundEffect { File shipshootingsound = new File("sound/soundEffect/Shipshooting.wav"); File shipdestructionsound = new File("sound/soundEffect/Shipdestruction.wav");