Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite mode #135

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 100 additions & 32 deletions src/engine/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public final class Core {
*/
private static int difficulty = 1;

public static boolean checkInfinity = false ;

/**
* Difficulty settings for level 1.
*/
Expand Down Expand Up @@ -188,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) {
Expand Down Expand Up @@ -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);

}

Expand All @@ -227,17 +230,33 @@ 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);

outgame_bgm.OutGame_bgm_stop(); //게임 대기 -> 시작으로 넘어가면서 outgame bgm 종료

// 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);
Expand All @@ -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{
Expand Down Expand Up @@ -512,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
Expand All @@ -523,17 +559,33 @@ 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);

outgame_bgm.OutGame_bgm_stop(); //게임 대기 -> 시작으로 넘어가면서 outgame bgm 종료

// 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);
Expand All @@ -543,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{
Expand Down
9 changes: 7 additions & 2 deletions src/engine/DrawManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/engine/SoundEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down