diff --git a/src/engine/Cooldown.java b/src/engine/Cooldown.java
index 4eeb105ea..ed852c862 100644
--- a/src/engine/Cooldown.java
+++ b/src/engine/Cooldown.java
@@ -2,27 +2,34 @@
/**
* Imposes a cooldown period between two actions.
- *
+ * 두 행동 사이에 재사용 대기시간을 부과합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Cooldown {
- /** Cooldown duration. */
+ /** Cooldown duration.
+ * 재사용 대기시간. */
private int milliseconds;
- /** Maximum difference between durations. */
+ /** Maximum difference between durations.
+ * duration들 간의 최대 차이입니다. */
private int variance;
- /** Duration of this run, varies between runs if variance > 0. */
+ /** Duration of this run, varies between runs if variance > 0.
+ * 이 실행 duration은 (variance > 0)인 경우 실행 간에 다릅니다. */
private int duration;
- /** Beginning time. */
+ /** Beginning time.
+ * 시작 시간입니다. */
private long time;
/**
* Constructor, established the time until the action can be performed
* again.
- *
+ * 생성자, 작업을 다시 수행할 수 있을 때까지의 시간을 설정합니다.
+ *
* @param milliseconds
* Time until cooldown period is finished.
+ * 재사용 대기 시간이 끝날 때까지의 시간입니다.
*/
protected Cooldown(final int milliseconds) {
this.milliseconds = milliseconds;
@@ -34,11 +41,14 @@ protected Cooldown(final int milliseconds) {
/**
* Constructor, established the time until the action can be performed
* again, with a variation of +/- variance.
- *
+ * 생성자는 +/- variation의 변형으로 작업을 다시 수행할 수 있을 때까지의 시간을 설정합니다.
+ *
* @param milliseconds
* Time until cooldown period is finished.
+ * 재사용 대기 시간이 끝날 때까지의 시간입니다.
* @param variance
* Variance in the cooldown period.
+ * 재사용 대기 시간의 variance.
*/
protected Cooldown(final int milliseconds, final int variance) {
this.milliseconds = milliseconds;
@@ -48,7 +58,8 @@ protected Cooldown(final int milliseconds, final int variance) {
/**
* Checks if the cooldown is finished.
- *
+ * 쿨다운이 완료되었는지 확인합니다.
+ *
* @return Cooldown state.
*/
public final boolean checkFinished() {
@@ -60,12 +71,13 @@ public final boolean checkFinished() {
/**
* Restarts the cooldown.
+ * 재사용 대기시간을 다시 시작합니다.
*/
public final void reset() {
this.time = System.currentTimeMillis();
if (this.variance != 0)
this.duration = (this.milliseconds - this.variance)
+ (int) (Math.random()
- * (this.milliseconds + this.variance));
+ * (this.milliseconds + this.variance));
}
}
diff --git a/src/engine/Core.java b/src/engine/Core.java
index 35cc8274c..a2ef67d30 100644
--- a/src/engine/Core.java
+++ b/src/engine/Core.java
@@ -16,26 +16,34 @@
/**
* Implements core game logic.
- *
+ * 핵심 게임 로직을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public final class Core {
- /** Width of current screen. */
+ /** Width of current screen.
+ * 현재 화면의 너비입니다. */
private static final int WIDTH = 448;
- /** Height of current screen. */
+ /** Height of current screen.
+ * 현재 화면의 높이입니다. */
private static final int HEIGHT = 520;
- /** Max fps of current screen. */
+ /** Max fps of current screen.
+ * 현재 화면의 최대 fps. */
private static final int FPS = 60;
- /** Max lives. */
+ /** Max lives.
+ * 최대 목숨 개수 */
private static final int MAX_LIVES = 3;
- /** Levels between extra life. */
+ /** Levels between extra life.
+ * 레벨 사이의 추가 목숨 */
private static final int EXTRA_LIFE_FRECUENCY = 3;
- /** Total number of levels. */
+ /** Total number of levels.
+ * 총 레벨 수. */
private static final int NUM_LEVELS = 7;
-
+
+ /* 레벨들의 난이도 설정 */
/** Difficulty settings for level 1. */
private static final GameSettings SETTINGS_LEVEL_1 =
new GameSettings(5, 4, 60, 2000);
@@ -57,27 +65,35 @@ public final class Core {
/** Difficulty settings for level 7. */
private static final GameSettings SETTINGS_LEVEL_7 =
new GameSettings(8, 7, 2, 500);
-
- /** Frame to draw the screen on. */
+
+ /** Frame to draw the screen on.
+ * 화면을 그릴 Frame 입니다. */
private static Frame frame;
- /** Screen currently shown. */
+ /** Screen currently shown.
+ * 현재 보여지는 화면. */
private static Screen currentScreen;
- /** Difficulty settings list. */
+ /** Difficulty settings list.
+ * 난이도 설정 목록. */
private static List gameSettings;
- /** Application logger. */
+ /** Application logger.
+ * 애플리케이션 로거. */
private static final Logger LOGGER = Logger.getLogger(Core.class
.getSimpleName());
- /** Logger handler for printing to disk. */
+ /** Logger handler for printing to disk.
+ * 디스크에 프린팅하기 위한 로거 핸들러 */
private static Handler fileHandler;
- /** Logger handler for printing to console. */
+ /** Logger handler for printing to console.
+ * 콘솔에 프린팅하기 위한 로거 핸들러 */
private static ConsoleHandler consoleHandler;
/**
* Test implementation.
- *
+ * 테스트 구현.
+ *
* @param args
* Program args, ignored.
+ * 프로그램 인수, 무시됨.
*/
public static void main(final String[] args) {
try {
@@ -111,7 +127,7 @@ public static void main(final String[] args) {
gameSettings.add(SETTINGS_LEVEL_5);
gameSettings.add(SETTINGS_LEVEL_6);
gameSettings.add(SETTINGS_LEVEL_7);
-
+
GameState gameState;
int returnCode = 1;
@@ -119,61 +135,61 @@ public static void main(final String[] args) {
gameState = new GameState(1, 0, MAX_LIVES, 0, 0);
switch (returnCode) {
- case 1:
- // Main menu.
- currentScreen = new TitleScreen(width, height, FPS);
- LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
- + " title screen at " + FPS + " fps.");
- returnCode = frame.setScreen(currentScreen);
- LOGGER.info("Closing title screen.");
- break;
- case 2:
- // Game & score.
- do {
- // One extra live every few levels.
- boolean bonusLife = gameState.getLevel()
- % EXTRA_LIFE_FRECUENCY == 0
- && gameState.getLivesRemaining() < MAX_LIVES;
-
- currentScreen = new GameScreen(gameState,
- gameSettings.get(gameState.getLevel() - 1),
- bonusLife, width, height, FPS);
+ case 1:
+ // Main menu.
+ currentScreen = new TitleScreen(width, height, FPS);
+ LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
+ + " title screen at " + FPS + " fps.");
+ returnCode = frame.setScreen(currentScreen);
+ LOGGER.info("Closing title screen.");
+ break;
+ case 2:
+ // Game & score.
+ do {
+ // One extra live every few levels.
+ boolean bonusLife = gameState.getLevel()
+ % EXTRA_LIFE_FRECUENCY == 0
+ && gameState.getLivesRemaining() < MAX_LIVES;
+
+ currentScreen = new GameScreen(gameState,
+ gameSettings.get(gameState.getLevel() - 1),
+ bonusLife, width, height, FPS);
+ LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
+ + " game screen at " + FPS + " fps.");
+ frame.setScreen(currentScreen);
+ LOGGER.info("Closing game screen.");
+
+ gameState = ((GameScreen) currentScreen).getGameState();
+
+ gameState = new GameState(gameState.getLevel() + 1,
+ gameState.getScore(),
+ gameState.getLivesRemaining(),
+ gameState.getBulletsShot(),
+ gameState.getShipsDestroyed());
+
+ } while (gameState.getLivesRemaining() > 0
+ && gameState.getLevel() <= NUM_LEVELS);
+
+ LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
+ + " score screen at " + FPS + " fps, with a score of "
+ + gameState.getScore() + ", "
+ + gameState.getLivesRemaining() + " lives remaining, "
+ + gameState.getBulletsShot() + " bullets shot and "
+ + gameState.getShipsDestroyed() + " ships destroyed.");
+ currentScreen = new ScoreScreen(width, height, FPS, gameState);
+ returnCode = frame.setScreen(currentScreen);
+ LOGGER.info("Closing score screen.");
+ break;
+ case 3:
+ // High scores.
+ currentScreen = new HighScoreScreen(width, height, FPS);
LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
- + " game screen at " + FPS + " fps.");
- frame.setScreen(currentScreen);
- LOGGER.info("Closing game screen.");
-
- gameState = ((GameScreen) currentScreen).getGameState();
-
- gameState = new GameState(gameState.getLevel() + 1,
- gameState.getScore(),
- gameState.getLivesRemaining(),
- gameState.getBulletsShot(),
- gameState.getShipsDestroyed());
-
- } while (gameState.getLivesRemaining() > 0
- && gameState.getLevel() <= NUM_LEVELS);
-
- LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
- + " score screen at " + FPS + " fps, with a score of "
- + gameState.getScore() + ", "
- + gameState.getLivesRemaining() + " lives remaining, "
- + gameState.getBulletsShot() + " bullets shot and "
- + gameState.getShipsDestroyed() + " ships destroyed.");
- currentScreen = new ScoreScreen(width, height, FPS, gameState);
- returnCode = frame.setScreen(currentScreen);
- LOGGER.info("Closing score screen.");
- break;
- case 3:
- // High scores.
- currentScreen = new HighScoreScreen(width, height, FPS);
- LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
- + " high score screen at " + FPS + " fps.");
- returnCode = frame.setScreen(currentScreen);
- LOGGER.info("Closing high score screen.");
- break;
- default:
- break;
+ + " high score screen at " + FPS + " fps.");
+ returnCode = frame.setScreen(currentScreen);
+ LOGGER.info("Closing high score screen.");
+ break;
+ default:
+ break;
}
} while (returnCode != 0);
@@ -185,6 +201,7 @@ public static void main(final String[] args) {
/**
* Constructor, not called.
+ * 호출되지 않은 생성자.
*/
private Core() {
@@ -192,7 +209,8 @@ private Core() {
/**
* Controls access to the logger.
- *
+ * logger에 대한 액세스를 제어합니다.
+ *
* @return Application logger.
*/
public static Logger getLogger() {
@@ -201,7 +219,8 @@ public static Logger getLogger() {
/**
* Controls access to the drawing manager.
- *
+ * drawing manager에 대한 액세스를 제어합니다.
+ *
* @return Application draw manager.
*/
public static DrawManager getDrawManager() {
@@ -210,7 +229,8 @@ public static DrawManager getDrawManager() {
/**
* Controls access to the input manager.
- *
+ * input manager에 대한 액세스를 제어합니다.
+ *
* @return Application input manager.
*/
public static InputManager getInputManager() {
@@ -219,7 +239,8 @@ public static InputManager getInputManager() {
/**
* Controls access to the file manager.
- *
+ * input manager에 대한 액세스를 제어합니다.
+ *
* @return Application file manager.
*/
public static FileManager getFileManager() {
@@ -228,7 +249,8 @@ public static FileManager getFileManager() {
/**
* Controls creation of new cooldowns.
- *
+ * 새로운 재사용 대기시간 생성을 제어합니다.
+ *
* @param milliseconds
* Duration of the cooldown.
* @return A new cooldown.
@@ -239,15 +261,18 @@ public static Cooldown getCooldown(final int milliseconds) {
/**
* Controls creation of new cooldowns with variance.
- *
+ * variance가 있는 새로운 재사용 대기시간 생성을 제어합니다.
+ *
* @param milliseconds
* Duration of the cooldown.
+ * 재사용 대기시간.
* @param variance
* Variation in the cooldown duration.
+ * 재사용 대기시간의 variance.
* @return A new cooldown with variance.
*/
public static Cooldown getVariableCooldown(final int milliseconds,
- final int variance) {
+ final int variance) {
return new Cooldown(milliseconds, variance);
}
}
\ No newline at end of file
diff --git a/src/engine/DrawManager.java b/src/engine/DrawManager.java
index 3d61ca503..5a3d2e46f 100644
--- a/src/engine/DrawManager.java
+++ b/src/engine/DrawManager.java
@@ -18,13 +18,15 @@
/**
* Manages screen drawing.
- *
+ * 화면 그리기를 관리합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public final class DrawManager {
- /** Singleton instance of the class. */
+ /** Singleton instance of the class.
+ * 클래스의 싱글톤 인스턴스입니다. */
private static DrawManager instance;
/** Current frame. */
private static Frame frame;
@@ -47,7 +49,8 @@ public final class DrawManager {
/** Big sized font properties. */
private static FontMetrics fontBigMetrics;
- /** Sprite types mapped to their images. */
+ /** Sprite types mapped to their images.
+ * 이미지에 매핑된 스프라이트 유형입니다. */
private static Map spriteMap;
/** Sprite types. */
@@ -80,6 +83,7 @@ public static enum SpriteType {
/**
* Private constructor.
+ * private 생성자
*/
private DrawManager() {
fileManager = Core.getFileManager();
@@ -119,7 +123,8 @@ private DrawManager() {
/**
* Returns shared instance of DrawManager.
- *
+ * DrawManager의 공유된 인스턴스를 반환합니다.
+ *
* @return Shared instance of DrawManager.
*/
protected static DrawManager getInstance() {
@@ -130,7 +135,8 @@ protected static DrawManager getInstance() {
/**
* Sets the frame to draw the image on.
- *
+ * 이미지를 그릴 프레임을 설정합니다.
+ *
* @param currentFrame
* Frame to draw on.
*/
@@ -139,11 +145,13 @@ public void setFrame(final Frame currentFrame) {
}
/**
- * First part of the drawing process. Initialices buffers, draws the
+ * First part of the drawing process. Initializes buffers, draws the
* background and prepares the images.
- *
+ * 드로잉 프로세스의 첫 번째 부분입니다. 버퍼를 초기화하고 배경을 그리고 이미지를 준비합니다.
+ *
* @param screen
* Screen to draw in.
+ * 그릴 수 있는 화면입니다.
*/
public void initDrawing(final Screen screen) {
backBuffer = new BufferedImage(screen.getWidth(), screen.getHeight(),
@@ -165,9 +173,11 @@ public void initDrawing(final Screen screen) {
/**
* Draws the completed drawing on screen.
- *
+ * 완성된 그림을 화면에 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
*/
public void completeDrawing(final Screen screen) {
graphics.drawImage(backBuffer, frame.getInsets().left,
@@ -175,17 +185,21 @@ public void completeDrawing(final Screen screen) {
}
/**
- * Draws an entity, using the apropiate image.
- *
+ * Draws an entity, using the appropriate image.
+ * 적절한 이미지를 사용하여 entity를 그립니다.
+ *
* @param entity
* Entity to be drawn.
+ * 그려질 entity 입니다.
* @param positionX
* Coordinates for the left side of the image.
+ * 이미지의 왼쪽에 대한 좌표입니다.
* @param positionY
* Coordinates for the upper side of the image.
+ * 이미지의 위쪽에 대한 좌표입니다.
*/
public void drawEntity(final Entity entity, final int positionX,
- final int positionY) {
+ final int positionY) {
boolean[][] image = spriteMap.get(entity.getSpriteType());
backBufferGraphics.setColor(entity.getColor());
@@ -197,10 +211,12 @@ public void drawEntity(final Entity entity, final int positionX,
}
/**
- * For debugging purpouses, draws the canvas borders.
- *
+ * For debugging purposes, draws the canvas borders.
+ * 디버깅을 위해 캔버스 테두리를 그립니다.
+ *
* @param screen
* Screen to draw in.
+ * 그릴 수 있는 화면입니다.
*/
@SuppressWarnings("unused")
private void drawBorders(final Screen screen) {
@@ -214,10 +230,12 @@ private void drawBorders(final Screen screen) {
}
/**
- * For debugging purpouses, draws a grid over the canvas.
- *
+ * For debugging purposes, draws a grid over the canvas.
+ * 디버깅을 위해 캔버스 위에 그리드를 그립니다.
+ *
* @param screen
* Screen to draw in.
+ * 그릴 수 있는 화면입니다.
*/
@SuppressWarnings("unused")
private void drawGrid(final Screen screen) {
@@ -230,11 +248,14 @@ private void drawGrid(final Screen screen) {
/**
* Draws current score on screen.
- *
+ * 화면에 현재 점수를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 수 있는 화면입니다.
* @param score
* Current score.
+ * 현재 점수.
*/
public void drawScore(final Screen screen, final int score) {
backBufferGraphics.setFont(fontRegular);
@@ -245,11 +266,14 @@ public void drawScore(final Screen screen, final int score) {
/**
* Draws number of remaining lives on screen.
- *
+ * 화면에 남은 목숨 수를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 수 있는 화면입니다.
* @param lives
* Current lives.
+ * 현재 목숨.
*/
public void drawLives(final Screen screen, final int lives) {
backBufferGraphics.setFont(fontRegular);
@@ -262,11 +286,14 @@ public void drawLives(final Screen screen, final int lives) {
/**
* Draws a thick line from side to side of the screen.
- *
+ * 화면의 좌우로 굵은 선을 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 수 있는 화면입니다.
* @param positionY
* Y coordinate of the line.
+ * 선의 Y 좌표입니다.
*/
public void drawHorizontalLine(final Screen screen, final int positionY) {
backBufferGraphics.setColor(Color.GREEN);
@@ -277,9 +304,11 @@ public void drawHorizontalLine(final Screen screen, final int positionY) {
/**
* Draws game title.
- *
+ * 게임 제목을 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 수 있는 화면입니다.
*/
public void drawTitle(final Screen screen) {
String titleString = "Invaders";
@@ -296,11 +325,14 @@ public void drawTitle(final Screen screen) {
/**
* Draws main menu.
- *
+ * 메인 메뉴를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param option
* Option selected.
+ * 선택된 옵션.
*/
public void drawMenu(final Screen screen, final int option) {
String playString = "Play";
@@ -329,23 +361,30 @@ public void drawMenu(final Screen screen, final int option) {
/**
* Draws game results.
- *
+ * 게임 결과를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param score
* Score obtained.
+ * 획득한 점수입니다.
* @param livesRemaining
* Lives remaining when finished.
+ * 끝났을 때 남아있는 목숨 수.
* @param shipsDestroyed
* Total ships destroyed.
+ * 파괴된 총 ships.
* @param accuracy
* Total accuracy.
+ * 전체 총 정확도.
* @param isNewRecord
* If the score is a new high score.
+ * 점수가 새로운 최고 점수인 경우.
*/
public void drawResults(final Screen screen, final int score,
- final int livesRemaining, final int shipsDestroyed,
- final float accuracy, final boolean isNewRecord) {
+ final int livesRemaining, final int shipsDestroyed,
+ final float accuracy, final boolean isNewRecord) {
String scoreString = String.format("score %04d", score);
String livesRemainingString = "lives remaining " + livesRemaining;
String shipsDestroyedString = "enemies destroyed " + shipsDestroyed;
@@ -369,16 +408,20 @@ public void drawResults(final Screen screen, final int score,
/**
* Draws interactive characters for name input.
- *
+ * 이름 입력을 위한 interactive characters를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param name
* Current name selected.
+ * 현재 선택된 이름.
* @param nameCharSelected
* Current character selected for modification.
+ * 수정을 위해 선택된 현재 character입니다.
*/
public void drawNameInput(final Screen screen, final char[] name,
- final int nameCharSelected) {
+ final int nameCharSelected) {
String newRecordString = "New Record!";
String introduceNameString = "Introduce name:";
@@ -393,9 +436,9 @@ public void drawNameInput(final Screen screen, final char[] name,
int positionX = screen.getWidth()
/ 2
- (fontRegularMetrics.getWidths()[name[0]]
- + fontRegularMetrics.getWidths()[name[1]]
- + fontRegularMetrics.getWidths()[name[2]]
- + fontRegularMetrics.getWidths()[' ']) / 2;
+ + fontRegularMetrics.getWidths()[name[1]]
+ + fontRegularMetrics.getWidths()[name[2]]
+ + fontRegularMetrics.getWidths()[' ']) / 2;
for (int i = 0; i < 3; i++) {
if (i == nameCharSelected)
@@ -406,8 +449,8 @@ public void drawNameInput(final Screen screen, final char[] name,
positionX += fontRegularMetrics.getWidths()[name[i]] / 2;
positionX = i == 0 ? positionX
: positionX
- + (fontRegularMetrics.getWidths()[name[i - 1]]
- + fontRegularMetrics.getWidths()[' ']) / 2;
+ + (fontRegularMetrics.getWidths()[name[i - 1]]
+ + fontRegularMetrics.getWidths()[' ']) / 2;
backBufferGraphics.drawString(Character.toString(name[i]),
positionX,
@@ -418,16 +461,20 @@ public void drawNameInput(final Screen screen, final char[] name,
/**
* Draws basic content of game over screen.
- *
+ * 게임의 기본 콘텐츠를 화면 위에 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param acceptsInput
* If the screen accepts input.
+ * 화면이 입력을 수락하는 경우.
* @param isNewRecord
* If the score is a new high score.
+ * 점수가 새로운 최고 점수인 경우.
*/
public void drawGameOver(final Screen screen, final boolean acceptsInput,
- final boolean isNewRecord) {
+ final boolean isNewRecord) {
String gameOverString = "Game Over";
String continueOrExitString =
"Press Space to play again, Escape to exit";
@@ -448,9 +495,11 @@ public void drawGameOver(final Screen screen, final boolean acceptsInput,
/**
* Draws high score screen title and instructions.
- *
+ * 고득점 화면 제목과 지침을 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
*/
public void drawHighScoreMenu(final Screen screen) {
String highScoreString = "High Scores";
@@ -466,14 +515,17 @@ public void drawHighScoreMenu(final Screen screen) {
/**
* Draws high scores.
- *
+ * 높은 점수를 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param highScores
* List of high scores.
+ * 높은 점수 목록입니다.
*/
public void drawHighScores(final Screen screen,
- final List highScores) {
+ final List highScores) {
backBufferGraphics.setColor(Color.WHITE);
int i = 0;
String scoreString = "";
@@ -489,16 +541,20 @@ public void drawHighScores(final Screen screen,
/**
* Draws a centered string on regular font.
- *
+ * regular font로 centered string을 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param string
* String to draw.
+ * 그릴 문자열입니다.
* @param height
* Height of the drawing.
+ * 그림의 높이입니다.
*/
public void drawCenteredRegularString(final Screen screen,
- final String string, final int height) {
+ final String string, final int height) {
backBufferGraphics.setFont(fontRegular);
backBufferGraphics.drawString(string, screen.getWidth() / 2
- fontRegularMetrics.stringWidth(string) / 2, height);
@@ -506,16 +562,20 @@ public void drawCenteredRegularString(final Screen screen,
/**
* Draws a centered string on big font.
- *
+ * big font로 centered string을 그립니다.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param string
* String to draw.
+ * 그릴 문자열입니다.
* @param height
* Height of the drawing.
+ * 그림의 높이입니다.
*/
public void drawCenteredBigString(final Screen screen, final String string,
- final int height) {
+ final int height) {
backBufferGraphics.setFont(fontBig);
backBufferGraphics.drawString(string, screen.getWidth() / 2
- fontBigMetrics.stringWidth(string) / 2, height);
@@ -523,18 +583,23 @@ public void drawCenteredBigString(final Screen screen, final String string,
/**
* Countdown to game start.
- *
+ * 게임 시작 카운트다운.
+ *
* @param screen
* Screen to draw on.
+ * 그릴 화면입니다.
* @param level
* Game difficulty level.
+ * 게임 난이도.
* @param number
* Countdown number.
+ * 카운트다운 번호입니다.
* @param bonusLife
* Checks if a bonus life is received.
+ * 보너스 목숨을 받았는지 확인합니다.
*/
public void drawCountDown(final Screen screen, final int level,
- final int number, final boolean bonusLife) {
+ final int number, final boolean bonusLife) {
int rectWidth = screen.getWidth();
int rectHeight = screen.getHeight() / 6;
backBufferGraphics.setColor(Color.BLACK);
@@ -545,12 +610,12 @@ public void drawCountDown(final Screen screen, final int level,
if (!bonusLife) {
drawCenteredBigString(screen, "Level " + level,
screen.getHeight() / 2
- + fontBigMetrics.getHeight() / 3);
+ + fontBigMetrics.getHeight() / 3);
} else {
drawCenteredBigString(screen, "Level " + level
- + " - Bonus life!",
+ + " - Bonus life!",
screen.getHeight() / 2
- + fontBigMetrics.getHeight() / 3);
+ + fontBigMetrics.getHeight() / 3);
}
else if (number != 0)
drawCenteredBigString(screen, Integer.toString(number),
diff --git a/src/engine/FileManager.java b/src/engine/FileManager.java
index 42ab4754b..d0e225751 100644
--- a/src/engine/FileManager.java
+++ b/src/engine/FileManager.java
@@ -25,21 +25,25 @@
/**
* Manages files used in the application.
- *
+ * 애플리케이션에서 사용되는 파일을 관리합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public final class FileManager {
- /** Singleton instance of the class. */
+ /** Singleton instance of the class.
+ * 클래스의 싱글톤 인스턴스입니다. */
private static FileManager instance;
/** Application logger. */
private static Logger logger;
- /** Max number of high scores. */
+ /** Max number of high scores.
+ * 최고 점수의 최대 수입니다. */
private static final int MAX_SCORES = 7;
/**
* private constructor.
+ * private 생성자.
*/
private FileManager() {
logger = Core.getLogger();
@@ -47,7 +51,8 @@ private FileManager() {
/**
* Returns shared instance of FileManager.
- *
+ * FileManager의 공유된 인스턴스를 반환합니다.
+ *
* @return Shared instance of FileManager.
*/
protected static FileManager getInstance() {
@@ -58,12 +63,15 @@ protected static FileManager getInstance() {
/**
* Loads sprites from disk.
- *
+ * 디스크에서 스프라이트를 로드합니다.
+ *
* @param spriteMap
* Mapping of sprite type and empty boolean matrix that will
* contain the image.
+ * 이미지를 포함할 스프라이트 타입과 빈 부울 matrix의 매핑.
* @throws IOException
* In case of loading problems.
+ * 로딩 문제의 경우.
*/
public void loadSprite(final Map spriteMap)
throws IOException {
@@ -100,14 +108,18 @@ public void loadSprite(final Map spriteMap)
/**
* Loads a font of a given size.
- *
+ * 주어진 크기의 글꼴을 로드합니다.
+ *
* @param size
* Point size of the font.
+ * 글꼴의 포인트 크기입니다.
* @return New font.
* @throws IOException
* In case of loading problems.
+ * 로딩 문제의 경우.
* @throws FontFormatException
* In case of incorrect font format.
+ * 잘못된 글꼴 형식의 경우.
*/
public Font loadFont(final float size) throws IOException,
FontFormatException {
@@ -131,10 +143,12 @@ public Font loadFont(final float size) throws IOException,
/**
* Returns the application default scores if there is no user high scores
* file.
- *
+ * 사용자 최고 점수 파일이 없는 경우 애플리케이션 기본 점수를 반환합니다.
+ *
* @return Default high scores.
* @throws IOException
* In case of loading problems.
+ * 로딩 문제의 경우.
*/
private List loadDefaultHighScores() throws IOException {
List highScores = new ArrayList();
@@ -167,10 +181,13 @@ private List loadDefaultHighScores() throws IOException {
/**
* Loads high scores from file, and returns a sorted list of pairs score -
* value.
- *
+ * 파일에서 최고 점수를 로드하고 점수-값 쌍의 정렬된 목록을 반환합니다.
+ *
* @return Sorted list of scores - players.
+ * 점수의 정렬된 목록 - 플레이어.
* @throws IOException
* In case of loading problems.
+ * 로딩 문제의 경우.
*/
public List loadHighScores() throws IOException {
@@ -220,13 +237,16 @@ public List loadHighScores() throws IOException {
/**
* Saves user high scores to disk.
- *
+ * 사용자의 최고 점수를 디스크에 저장합니다.
+ *
* @param highScores
* High scores to save.
+ * 저장할 높은 점수.
* @throws IOException
* In case of loading problems.
+ * 로딩 문제의 경우.
*/
- public void saveHighScores(final List highScores)
+ public void saveHighScores(final List highScores)
throws IOException {
OutputStream outputStream = null;
BufferedWriter bufferedWriter = null;
diff --git a/src/engine/Frame.java b/src/engine/Frame.java
index b52997a8c..c5b28295c 100644
--- a/src/engine/Frame.java
+++ b/src/engine/Frame.java
@@ -8,9 +8,10 @@
/**
* Implements a frame to show screens on.
- *
+ * 화면을 표시할 프레임을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
@SuppressWarnings("serial")
public class Frame extends JFrame {
@@ -24,7 +25,7 @@ public class Frame extends JFrame {
/**
* Initializes the new frame.
- *
+ *
* @param width
* Frame width.
* @param height
@@ -48,7 +49,7 @@ public Frame(final int width, final int height) {
/**
* Sets current screen.
- *
+ *
* @param screen
* Screen to show.
* @return Return code of the finished screen.
@@ -61,7 +62,7 @@ public final int setScreen(final Screen screen) {
/**
* Getter for frame width.
- *
+ *
* @return Frame width.
*/
public final int getWidth() {
@@ -70,7 +71,7 @@ public final int getWidth() {
/**
* Getter for frame height.
- *
+ *
* @return Frame height.
*/
diff --git a/src/engine/GameSettings.java b/src/engine/GameSettings.java
index 314faf536..1b35fdd9e 100644
--- a/src/engine/GameSettings.java
+++ b/src/engine/GameSettings.java
@@ -2,24 +2,29 @@
/**
* Implements an object that stores a single game's difficulty settings.
- *
+ * 단일 게임의 난이도 설정을 저장하는 개체를 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class GameSettings {
- /** Width of the level's enemy formation. */
+ /** Width of the level's enemy formation.
+ * 레벨의 적 포메이션의 너비입니다. */
private int formationWidth;
- /** Height of the level's enemy formation. */
+ /** Height of the level's enemy formation.
+ * 레벨의 적 포메이션의 높이입니다. */
private int formationHeight;
- /** Speed of the enemies, function of the remaining number. */
+ /** Speed of the enemies, function of the remaining number.
+ * 적들의 속도, 남은 숫자의 기능. */
private int baseSpeed;
- /** Frequency of enemy shootings, +/- 30%. */
+ /** Frequency of enemy shootings, +/- 30%.
+ * 적의 총격 빈도, +/- 30%. */
private int shootingFrecuency;
/**
* Constructor.
- *
+ *
* @param formationWidth
* Width of the level's enemy formation.
* @param formationHeight
@@ -30,7 +35,7 @@ public class GameSettings {
* Frecuency of enemy shootings, +/- 30%.
*/
public GameSettings(final int formationWidth, final int formationHeight,
- final int baseSpeed, final int shootingFrecuency) {
+ final int baseSpeed, final int shootingFrecuency) {
this.formationWidth = formationWidth;
this.formationHeight = formationHeight;
this.baseSpeed = baseSpeed;
diff --git a/src/engine/GameState.java b/src/engine/GameState.java
index 03fe4ebe8..1d15a6cc1 100644
--- a/src/engine/GameState.java
+++ b/src/engine/GameState.java
@@ -2,9 +2,10 @@
/**
* Implements an object that stores the state of the game between levels.
- *
+ * 레벨 사이의 게임 상태를 저장하는 object를 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class GameState {
@@ -21,7 +22,7 @@ public class GameState {
/**
* Constructor.
- *
+ *
* @param level
* Current game level.
* @param score
@@ -34,8 +35,8 @@ public class GameState {
* Ships destroyed until now.
*/
public GameState(final int level, final int score,
- final int livesRemaining, final int bulletsShot,
- final int shipsDestroyed) {
+ final int livesRemaining, final int bulletsShot,
+ final int shipsDestroyed) {
this.level = level;
this.score = score;
this.livesRemaining = livesRemaining;
diff --git a/src/engine/InputManager.java b/src/engine/InputManager.java
index 51b57f4ab..3935fe4e2 100644
--- a/src/engine/InputManager.java
+++ b/src/engine/InputManager.java
@@ -5,17 +5,21 @@
/**
* Manages keyboard input for the provided screen.
- *
+ * 제공된 화면에 대한 키보드 입력을 관리합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public final class InputManager implements KeyListener {
- /** Number of recognised keys. */
+ /** Number of recognised keys.
+ * 인식된 키의 수입니다. */
private static final int NUM_KEYS = 256;
- /** Array with the jeys marked as pressed or not. */
+ /** Array with the keys marked as pressed or not.
+ * 눌렸는지 여부로 표시된 keys가 있는 배열입니다. */
private static boolean[] keys;
- /** Singleton instance of the class. */
+ /** Singleton instance of the class.
+ * 클래스의 싱글톤 인스턴스입니다. */
private static InputManager instance;
/**
@@ -27,7 +31,8 @@ private InputManager() {
/**
* Returns shared instance of InputManager.
- *
+ * InputManager의 공유된 인스턴스를 반환합니다.
+ *
* @return Shared instance of InputManager.
*/
protected static InputManager getInstance() {
@@ -38,9 +43,11 @@ protected static InputManager getInstance() {
/**
* Returns true if the provided key is currently pressed.
- *
+ * 제공된 키가 현재 눌러져 있으면 true를 반환합니다.
+ *
* @param keyCode
* Key number to check.
+ * 확인할 키 번호입니다.
* @return Key state.
*/
public boolean isKeyDown(final int keyCode) {
@@ -49,7 +56,8 @@ public boolean isKeyDown(final int keyCode) {
/**
* Changes the state of the key to pressed.
- *
+ * 키의 상태를 눌린 상태로 변경합니다.
+ *
* @param key
* Key pressed.
*/
@@ -61,7 +69,8 @@ public void keyPressed(final KeyEvent key) {
/**
* Changes the state of the key to not pressed.
- *
+ * 키를 누르지 않은 상태로 변경합니다.
+ *
* @param key
* Key released.
*/
@@ -73,7 +82,7 @@ public void keyReleased(final KeyEvent key) {
/**
* Does nothing.
- *
+ *
* @param key
* Key typed.
*/
diff --git a/src/engine/MinimalFormatter.java b/src/engine/MinimalFormatter.java
index a01fd5c7d..aba12f1ee 100644
--- a/src/engine/MinimalFormatter.java
+++ b/src/engine/MinimalFormatter.java
@@ -8,15 +8,18 @@
/**
* Implements a simple logging format.
- *
+ * 간단한 로깅 형식을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class MinimalFormatter extends Formatter {
- /** Format for the date. */
+ /** Format for the date.
+ * 날짜 형식입니다. */
private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
- /** System line separator. */
+ /** System line separator.
+ * 시스템 줄 구분자. */
private static final String LINE_SEPARATOR = System
.getProperty("line.separator");
diff --git a/src/engine/Score.java b/src/engine/Score.java
index ebadff4e9..668bee586 100644
--- a/src/engine/Score.java
+++ b/src/engine/Score.java
@@ -2,9 +2,10 @@
/**
* Implements a high score record.
- *
+ * 높은 점수 기록을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Score implements Comparable {
@@ -15,7 +16,7 @@ public class Score implements Comparable {
/**
* Constructor.
- *
+ *
* @param name
* Player name, three letters.
* @param score
@@ -28,7 +29,7 @@ public Score(final String name, final int score) {
/**
* Getter for the player's name.
- *
+ *
* @return Name of the player.
*/
public final String getName() {
@@ -37,7 +38,7 @@ public final String getName() {
/**
* Getter for the player's score.
- *
+ *
* @return High score.
*/
public final int getScore() {
@@ -46,7 +47,7 @@ public final int getScore() {
/**
* Orders the scores descending by score.
- *
+ *
* @param score
* Score to compare the current one with.
* @return Comparison between the two scores. Positive if the current one is
diff --git a/src/entity/Bullet.java b/src/entity/Bullet.java
index ba13c219b..3e17ce819 100644
--- a/src/entity/Bullet.java
+++ b/src/entity/Bullet.java
@@ -6,28 +6,33 @@
/**
* Implements a bullet that moves vertically up or down.
- *
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Bullet extends Entity {
/**
* Speed of the bullet, positive or negative depending on direction -
* positive is down.
+ * 총알의 속도, 방향에 따라 양수 또는 음수 - 양수는 아래입니다.
*/
private int speed;
/**
* Constructor, establishes the bullet's properties.
- *
+ * 생성자, 총알의 속성을 설정합니다.
+ *
* @param positionX
* Initial position of the bullet in the X axis.
+ * X축에서 총알의 초기 위치입니다.
* @param positionY
* Initial position of the bullet in the Y axis.
+ * Y축에서 총알의 초기 위치입니다.
* @param speed
* Speed of the bullet, positive or negative depending on
* direction - positive is down.
+ * 총알의 속도, 방향에 따라 양수 또는 음수 - 양수는 아래입니다.
*/
public Bullet(final int positionX, final int positionY, final int speed) {
super(positionX, positionY, 3 * 2, 5 * 2, Color.WHITE);
@@ -38,6 +43,7 @@ public Bullet(final int positionX, final int positionY, final int speed) {
/**
* Sets correct sprite for the bullet, based on speed.
+ * 속도에 따라 총알에 대한 올바른 스프라이트를 설정합니다.
*/
public final void setSprite() {
if (speed < 0)
@@ -48,6 +54,7 @@ public final void setSprite() {
/**
* Updates the bullet's position.
+ * 총알의 위치를 업데이트합니다.
*/
public final void update() {
this.positionY += this.speed;
@@ -55,7 +62,8 @@ public final void update() {
/**
* Setter of the speed of the bullet.
- *
+ * 총알 속도에 대한 Setter.
+ *
* @param speed
* New speed of the bullet.
*/
@@ -65,7 +73,8 @@ public final void setSpeed(final int speed) {
/**
* Getter for the speed of the bullet.
- *
+ * 총알 속도에 대한 Getter.
+ *
* @return Speed of the bullet.
*/
public final int getSpeed() {
diff --git a/src/entity/BulletPool.java b/src/entity/BulletPool.java
index ae74e5606..6f954c16e 100644
--- a/src/entity/BulletPool.java
+++ b/src/entity/BulletPool.java
@@ -5,13 +5,15 @@
/**
* Implements a pool of recyclable bullets.
- *
+ * 재활용 가능한 총알 풀을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public final class BulletPool {
- /** Set of already created bullets. */
+ /** Set of already created bullets.
+ * 이미 생성된 총알들의 집합입니다. */
private static Set pool = new HashSet();
/**
@@ -24,18 +26,22 @@ private BulletPool() {
/**
* Returns a bullet from the pool if one is available, a new one if there
* isn't.
- *
+ * 사용 가능한 경우 풀에서 총알을 반환하고 없는 경우 새 총알을 반환합니다.
+ *
* @param positionX
* Requested position of the bullet in the X axis.
+ * X축에서 총알의 요청된 위치입니다.
* @param positionY
* Requested position of the bullet in the Y axis.
+ * Y축에서 총알의 요청된 위치입니다.
* @param speed
* Requested speed of the bullet, positive or negative depending
* on direction - positive is down.
+ * 총알의 요청된 속도, 방향에 따라 양수 또는 음수 - 양수는 아래입니다.
* @return Requested bullet.
*/
public static Bullet getBullet(final int positionX,
- final int positionY, final int speed) {
+ final int positionY, final int speed) {
Bullet bullet;
if (!pool.isEmpty()) {
bullet = pool.iterator().next();
@@ -53,7 +59,8 @@ public static Bullet getBullet(final int positionX,
/**
* Adds one or more bullets to the list of available ones.
- *
+ * 사용 가능한 목록에 하나 이상의 총알들을 추가합니다.
+ *
* @param bullet
* Bullets to recycle.
*/
diff --git a/src/entity/EnemyShip.java b/src/entity/EnemyShip.java
index 19d9958ad..8609fd359 100644
--- a/src/entity/EnemyShip.java
+++ b/src/entity/EnemyShip.java
@@ -8,12 +8,13 @@
/**
* Implements a enemy ship, to be destroyed by the player.
- *
+ * 플레이어가 파괴할 적 함선을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class EnemyShip extends Entity {
-
+
/** Point value of a type A enemy. */
private static final int A_TYPE_POINTS = 10;
/** Point value of a type B enemy. */
@@ -23,22 +24,29 @@ public class EnemyShip extends Entity {
/** Point value of a bonus enemy. */
private static final int BONUS_TYPE_POINTS = 100;
- /** Cooldown between sprite changes. */
+ /** Cooldown between sprite changes.
+ * 스프라이트 변경 사이의 쿨다운. */
private Cooldown animationCooldown;
- /** Checks if the ship has been hit by a bullet. */
+ /** Checks if the ship has been hit by a bullet.
+ * 함선이 총알에 맞았는지 확인합니다. */
private boolean isDestroyed;
- /** Values of the ship, in points, when destroyed. */
+ /** Values of the ship, in points, when destroyed.
+ * 파괴된 선박의 가치(포인트)입니다. */
private int pointValue;
/**
* Constructor, establishes the ship's properties.
- *
+ * 생성자, 함선의 속성을 설정합니다.
+ *
* @param positionX
* Initial position of the ship in the X axis.
+ * X축에서 함선의 초기 위치입니다.
* @param positionY
* Initial position of the ship in the Y axis.
+ * Y축에서 함선의 초기 위치입니다.
* @param spriteType
* Sprite type, image corresponding to the ship.
+ * 스프라이트 타입, 함선에 대응하는 이미지.
*/
public EnemyShip(final int positionX, final int positionY,
final SpriteType spriteType) {
@@ -70,6 +78,7 @@ public EnemyShip(final int positionX, final int positionY,
/**
* Constructor, establishes the ship's properties for a special ship, with
* known starting properties.
+ * 생성자, 알려진 시작 속성을 사용하여 특수 함선에 대한 함선 속성을 설정합니다.
*/
public EnemyShip() {
super(-32, 60, 16 * 2, 7 * 2, Color.RED);
@@ -81,7 +90,8 @@ public EnemyShip() {
/**
* Getter for the score bonus if this ship is destroyed.
- *
+ * 이 함선이 파괴되면 점수 보너스를 얻을 수 있습니다.
+ *
* @return Value of the ship.
*/
public final int getPointValue() {
@@ -90,11 +100,14 @@ public final int getPointValue() {
/**
* Moves the ship the specified distance.
- *
+ * 함선을 지정된 거리만큼 이동합니다.
+ *
* @param distanceX
* Distance to move in the X axis.
+ * X축에서 이동할 거리입니다.
* @param distanceY
* Distance to move in the Y axis.
+ * Y축에서 이동할 거리입니다.
*/
public final void move(final int distanceX, final int distanceY) {
this.positionX += distanceX;
@@ -103,38 +116,40 @@ public final void move(final int distanceX, final int distanceY) {
/**
* Updates attributes, mainly used for animation purposes.
+ * 주로 애니메이션 목적으로 사용되는 속성을 업데이트합니다.
*/
public final void update() {
if (this.animationCooldown.checkFinished()) {
this.animationCooldown.reset();
switch (this.spriteType) {
- case EnemyShipA1:
- this.spriteType = SpriteType.EnemyShipA2;
- break;
- case EnemyShipA2:
- this.spriteType = SpriteType.EnemyShipA1;
- break;
- case EnemyShipB1:
- this.spriteType = SpriteType.EnemyShipB2;
- break;
- case EnemyShipB2:
- this.spriteType = SpriteType.EnemyShipB1;
- break;
- case EnemyShipC1:
- this.spriteType = SpriteType.EnemyShipC2;
- break;
- case EnemyShipC2:
- this.spriteType = SpriteType.EnemyShipC1;
- break;
- default:
- break;
+ case EnemyShipA1:
+ this.spriteType = SpriteType.EnemyShipA2;
+ break;
+ case EnemyShipA2:
+ this.spriteType = SpriteType.EnemyShipA1;
+ break;
+ case EnemyShipB1:
+ this.spriteType = SpriteType.EnemyShipB2;
+ break;
+ case EnemyShipB2:
+ this.spriteType = SpriteType.EnemyShipB1;
+ break;
+ case EnemyShipC1:
+ this.spriteType = SpriteType.EnemyShipC2;
+ break;
+ case EnemyShipC2:
+ this.spriteType = SpriteType.EnemyShipC1;
+ break;
+ default:
+ break;
}
}
}
/**
* Destroys the ship, causing an explosion.
+ * 함선을 파괴하여 폭발을 일으킵니다.
*/
public final void destroy() {
this.isDestroyed = true;
@@ -143,7 +158,8 @@ public final void destroy() {
/**
* Checks if the ship has been destroyed.
- *
+ * 함선이 파괴되었는지 확인합니다.
+ *
* @return True if the ship has been destroyed.
*/
public final boolean isDestroyed() {
diff --git a/src/entity/EnemyShipFormation.java b/src/entity/EnemyShipFormation.java
index daf239551..871ee917f 100644
--- a/src/entity/EnemyShipFormation.java
+++ b/src/entity/EnemyShipFormation.java
@@ -16,37 +16,51 @@
/**
* Groups enemy ships into a formation that moves together.
- *
+ * 적 함선을 함께 이동하는 대형으로 그룹화합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class EnemyShipFormation implements Iterable {
- /** Initial position in the x-axis. */
+ /** Initial position in the x-axis.
+ * x축의 초기 위치입니다. */
private static final int INIT_POS_X = 20;
- /** Initial position in the y-axis. */
+ /** Initial position in the y-axis.
+ * y축의 초기 위치입니다. */
private static final int INIT_POS_Y = 100;
- /** Distance between ships. */
+ /** Distance between ships.
+ * 선박 사이의 거리. */
private static final int SEPARATION_DISTANCE = 40;
- /** Proportion of C-type ships. */
+ /** Proportion of C-type ships.
+ * C형 함선의 비율. */
private static final double PROPORTION_C = 0.2;
- /** Proportion of B-type ships. */
+ /** Proportion of B-type ships.
+ * B형 함선의 비율. */
private static final double PROPORTION_B = 0.4;
- /** Lateral speed of the formation. */
+ /** Lateral speed of the formation.
+ * 포메이션의 측면 속도. */
private static final int X_SPEED = 8;
- /** Downwards speed of the formation. */
+ /** Downwards speed of the formation.
+ * 포메이션의 하향 속도. */
private static final int Y_SPEED = 4;
- /** Speed of the bullets shot by the members. */
+ /** Speed of the bullets shot by the members.
+ * 멤버들이 쏘는 총알의 속도. */
private static final int BULLET_SPEED = 4;
- /** Proportion of differences between shooting times. */
+ /** Proportion of differences between shooting times.
+ * 쏘는 시간의 사이의 비율. */
private static final double SHOOTING_VARIANCE = .2;
- /** Margin on the sides of the screen. */
+ /** Margin on the sides of the screen.
+ * 화면 측면의 Margin. */
private static final int SIDE_MARGIN = 20;
- /** Margin on the bottom of the screen. */
+ /** Margin on the bottom of the screen.
+ * 화면 하단의 Margin. */
private static final int BOTTOM_MARGIN = 80;
- /** Distance to go down each pass. */
+ /** Distance to go down each pass.
+ * 각 패스를 내려가는 거리입니다. */
private static final int DESCENT_DISTANCE = 20;
- /** Minimum speed allowed. */
+ /** Minimum speed allowed.
+ * 허용되는 최소 속도. */
private static final int MINIMUM_SPEED = 10;
/** DrawManager instance. */
@@ -56,60 +70,85 @@ public class EnemyShipFormation implements Iterable {
/** Screen to draw ships on. */
private Screen screen;
- /** List of enemy ships forming the formation. */
+ /** List of enemy ships forming the formation.
+ * 포메이션을 형성하는 적 함선의 List. */
private List> enemyShips;
- /** Minimum time between shots. */
+ /** Minimum time between shots.
+ * 총 쏘기 사이의 최소 시간 */
private Cooldown shootingCooldown;
- /** Number of ships in the formation - horizontally. */
+ /** Number of ships in the formation - horizontally.
+ * 대형 선박의 수 - 수평. */
private int nShipsWide;
- /** Number of ships in the formation - vertically. */
+ /** Number of ships in the formation - vertically.
+ * 대형 선박의 수 - 수직. */
private int nShipsHigh;
- /** Time between shots. */
+ /** Time between shots.
+ * 총 쏘기 사이의 시간입니다. */
private int shootingInterval;
- /** Variance in the time between shots. */
+ /** Variance in the time between shots.
+ * 총 쏘기 사이의 시간 Variance. */
private int shootingVariance;
- /** Initial ship speed. */
+ /** Initial ship speed.
+ * 초기 함선 속도. */
private int baseSpeed;
- /** Speed of the ships. */
+ /** Speed of the ships.
+ * 함선의 속도. */
private int movementSpeed;
- /** Current direction the formation is moving on. */
+ /** Current direction the formation is moving on.
+ * 포메이션이 진행되고 있는 현재 방향. */
private Direction currentDirection;
- /** Direction the formation was moving previously. */
+ /** Direction the formation was moving previously.
+ * 포메이션이 이전에 움직이는 방향. */
private Direction previousDirection;
- /** Interval between movements, in frames. */
+ /** Interval between movements, in frames.
+ * 프레임 단위의 움직임 사이의 간격입니다. */
private int movementInterval;
- /** Total width of the formation. */
+ /** Total width of the formation.
+ * 포메이션의 총 너비. */
private int width;
- /** Total height of the formation. */
+ /** Total height of the formation.
+ * 포메이션의 총 높이. */
private int height;
- /** Position in the x-axis of the upper left corner of the formation. */
+ /** Position in the x-axis of the upper left corner of the formation.
+ * 포메이션의 왼쪽 상단 모서리의 x축 위치입니다. */
private int positionX;
- /** Position in the y-axis of the upper left corner of the formation. */
+ /** Position in the y-axis of the upper left corner of the formation.
+ * 포메이션의 왼쪽 상단 모서리의 y축 위치입니다. */
private int positionY;
- /** Width of one ship. */
+ /** Width of one ship.
+ * 한 선박의 너비입니다. */
private int shipWidth;
- /** Height of one ship. */
+ /** Height of one ship.
+ * 한 선박의 높이입니다. */
private int shipHeight;
- /** List of ships that are able to shoot. */
+ /** List of ships that are able to shoot.
+ * 쏠 수 있는 함선 목록입니다. */
private List shooters;
- /** Number of not destroyed ships. */
+ /** Number of not destroyed ships.
+ * 파괴되지 않은 선박의 수. */
private int shipCount;
- /** Directions the formation can move. */
+ /** Directions the formation can move.
+ * 포메이션이 움직일 수 있는 방향. */
private enum Direction {
- /** Movement to the right side of the screen. */
+ /** Movement to the right side of the screen.
+ * 화면 오른쪽으로 이동합니다. */
RIGHT,
- /** Movement to the left side of the screen. */
+ /** Movement to the left side of the screen.
+ * 화면 왼쪽으로 이동합니다. */
LEFT,
- /** Movement to the bottom of the screen. */
+ /** Movement to the bottom of the screen.
+ * 화면 하단으로 이동합니다. */
DOWN
};
/**
* Constructor, sets the initial conditions.
- *
+ * 생성자, 초기 조건을 설정합니다.
+ *
* @param gameSettings
* Current game settings.
+ * 현재 게임 설정.
*/
public EnemyShipFormation(final GameSettings gameSettings) {
this.drawManager = Core.getDrawManager();
@@ -146,10 +185,10 @@ else if (i / (float) this.nShipsHigh < PROPORTION_B
else
spriteType = SpriteType.EnemyShipA1;
- column.add(new EnemyShip((SEPARATION_DISTANCE
+ column.add(new EnemyShip((SEPARATION_DISTANCE
* this.enemyShips.indexOf(column))
- + positionX, (SEPARATION_DISTANCE * i)
- + positionY, spriteType));
+ + positionX, (SEPARATION_DISTANCE * i)
+ + positionY, spriteType));
this.shipCount++;
}
}
@@ -168,9 +207,11 @@ else if (i / (float) this.nShipsHigh < PROPORTION_B
/**
* Associates the formation to a given screen.
- *
+ * 포메이션을 주어진 화면에 연결합니다.
+ *
* @param newScreen
* Screen to attach.
+ * 첨부할 화면입니다.
*/
public final void attach(final Screen newScreen) {
screen = newScreen;
@@ -178,6 +219,7 @@ public final void attach(final Screen newScreen) {
/**
* Draws every individual component of the formation.
+ * 포메이션의 모든 개별 구성 요소를 그립니다.
*/
public final void draw() {
for (List column : this.enemyShips)
@@ -188,6 +230,7 @@ public final void draw() {
/**
* Updates the position of the ships.
+ * 선박의 위치를 업데이트합니다.
*/
public final void update() {
if(this.shootingCooldown == null) {
@@ -195,7 +238,7 @@ public final void update() {
shootingVariance);
this.shootingCooldown.reset();
}
-
+
cleanUp();
int movementX = 0;
@@ -205,7 +248,7 @@ public final void update() {
this.movementSpeed = (int) (Math.pow(remainingProportion, 2)
* this.baseSpeed);
this.movementSpeed += MINIMUM_SPEED;
-
+
movementInterval++;
if (movementInterval >= this.movementSpeed) {
movementInterval = 0;
@@ -283,6 +326,7 @@ else if (currentDirection == Direction.LEFT)
/**
* Cleans empty columns, adjusts the width and height of the formation.
+ * 빈 열들을 정리하고 포메이션의 너비와 높이를 조정합니다.
*/
private void cleanUp() {
Set emptyColumns = new HashSet();
@@ -308,7 +352,7 @@ private void cleanUp() {
int leftMostPoint = 0;
int rightMostPoint = 0;
-
+
for (List column : this.enemyShips) {
if (!column.isEmpty()) {
if (leftMostPoint == 0)
@@ -326,7 +370,8 @@ private void cleanUp() {
/**
* Shoots a bullet downwards.
- *
+ * 총알을 아래로 쏩니다.
+ *
* @param bullets
* Bullets set to add the bullet being shot.
*/
@@ -344,7 +389,8 @@ public final void shoot(final Set bullets) {
/**
* Destroys a ship.
- *
+ * 선박을 파괴합니다.
+ *
* @param destroyedShip
* Ship to be destroyed.
*/
@@ -385,9 +431,11 @@ public final void destroy(final EnemyShip destroyedShip) {
/**
* Gets the ship on a given column that will be in charge of shooting.
- *
+ * 사격을 담당할 지정된 열에 배를 가져옵니다.
+ *
* @param column
* Column to search.
+ * 검색할 열입니다.
* @return New shooter ship.
*/
public final EnemyShip getNextShooter(final List column) {
@@ -404,7 +452,8 @@ public final EnemyShip getNextShooter(final List column) {
/**
* Returns an iterator over the ships in the formation.
- *
+ * 포메이션의 함선에 대한 iterator를 반환합니다.
+ *
* @return Iterator over the enemy ships.
*/
@Override
@@ -420,8 +469,10 @@ public final Iterator iterator() {
/**
* Checks if there are any ships remaining.
- *
+ * 남은 함선이 있는지 확인합니다.
+ *
* @return True when all ships have been destroyed.
+ * 모든 함선이 파괴되었을 때 참입니다.
*/
public final boolean isEmpty() {
return this.shipCount <= 0;
diff --git a/src/entity/Entity.java b/src/entity/Entity.java
index 9fe604fdf..ea9a8cabd 100644
--- a/src/entity/Entity.java
+++ b/src/entity/Entity.java
@@ -6,15 +6,18 @@
/**
* Implements a generic game entity.
- *
+ * 일반 게임 엔터티를 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Entity {
- /** Position in the x-axis of the upper left corner of the entity. */
+ /** Position in the x-axis of the upper left corner of the entity.
+ * 엔터티 왼쪽 위 모서리의 x축 위치입니다. */
protected int positionX;
- /** Position in the y-axis of the upper left corner of the entity. */
+ /** Position in the y-axis of the upper left corner of the entity.
+ * 엔티티의 왼쪽 위 모서리의 y축 위치입니다. */
protected int positionY;
/** Width of the entity. */
protected int width;
@@ -27,20 +30,26 @@ public class Entity {
/**
* Constructor, establishes the entity's generic properties.
- *
+ * 생성자, 엔터티의 일반 속성을 설정합니다.
+ *
* @param positionX
* Initial position of the entity in the X axis.
+ * X축에서 엔티티의 초기 위치입니다.
* @param positionY
* Initial position of the entity in the Y axis.
+ * Y축에서 엔티티의 초기 위치입니다.
* @param width
* Width of the entity.
+ * 엔터티의 너비입니다.
* @param height
* Height of the entity.
+ * 엔티티의 높이입니다.
* @param color
* Color of the entity.
+ * 엔티티의 색상입니다.
*/
public Entity(final int positionX, final int positionY, final int width,
- final int height, final Color color) {
+ final int height, final Color color) {
this.positionX = positionX;
this.positionY = positionY;
this.width = width;
@@ -50,7 +59,8 @@ public Entity(final int positionX, final int positionY, final int width,
/**
* Getter for the color of the entity.
- *
+ * 엔티티의 색상에 대한 Getter입니다.
+ *
* @return Color of the entity, used when drawing it.
*/
public final Color getColor() {
@@ -59,7 +69,8 @@ public final Color getColor() {
/**
* Getter for the X axis position of the entity.
- *
+ * 엔터티의 X축 위치에 대한 Getter입니다.
+ *
* @return Position of the entity in the X axis.
*/
public final int getPositionX() {
@@ -68,7 +79,8 @@ public final int getPositionX() {
/**
* Getter for the Y axis position of the entity.
- *
+ * 엔터티의 Y축 위치에 대한 Getter입니다.
+ *
* @return Position of the entity in the Y axis.
*/
public final int getPositionY() {
@@ -77,7 +89,8 @@ public final int getPositionY() {
/**
* Setter for the X axis position of the entity.
- *
+ * 엔터티의 X축 위치에 대한 Setter입니다.
+ *
* @param positionX
* New position of the entity in the X axis.
*/
@@ -87,7 +100,8 @@ public final void setPositionX(final int positionX) {
/**
* Setter for the Y axis position of the entity.
- *
+ * 엔터티의 Y축 위치에 대한 Setter입니다.
+ *
* @param positionY
* New position of the entity in the Y axis.
*/
@@ -97,7 +111,8 @@ public final void setPositionY(final int positionY) {
/**
* Getter for the sprite that the entity will be drawn as.
- *
+ * 엔티티가 그려질 스프라이트의 Getter입니다.
+ *
* @return Sprite corresponding to the entity.
*/
public final SpriteType getSpriteType() {
@@ -106,7 +121,8 @@ public final SpriteType getSpriteType() {
/**
* Getter for the width of the image associated to the entity.
- *
+ * 엔터티와 연결된 이미지의 너비에 대한 Getter입니다.
+ *
* @return Width of the entity.
*/
public final int getWidth() {
@@ -115,7 +131,8 @@ public final int getWidth() {
/**
* Getter for the height of the image associated to the entity.
- *
+ * 엔터티와 연결된 이미지의 높이에 대한 Getter입니다.
+ *
* @return Height of the entity.
*/
public final int getHeight() {
diff --git a/src/entity/Ship.java b/src/entity/Ship.java
index fd007fde1..9199c4d42 100644
--- a/src/entity/Ship.java
+++ b/src/entity/Ship.java
@@ -9,27 +9,34 @@
/**
* Implements a ship, to be controlled by the player.
- *
+ * 플레이어가 제어할 함선을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Ship extends Entity {
- /** Time between shots. */
+ /** Time between shots.
+ * 샷 사이의 시간. */
private static final int SHOOTING_INTERVAL = 750;
- /** Speed of the bullets shot by the ship. */
+ /** Speed of the bullets shot by the ship.
+ * 함선이 발사하는 총알의 속도. */
private static final int BULLET_SPEED = -6;
- /** Movement of the ship for each unit of time. */
+ /** Movement of the ship for each unit of time.
+ * 시간 단위별 배의 움직임. */
private static final int SPEED = 2;
-
- /** Minimum time between shots. */
+
+ /** Minimum time between shots.
+ * 샷 사이의 최소 시간. */
private Cooldown shootingCooldown;
- /** Time spent inactive between hits. */
+ /** Time spent inactive between hits.
+ * hits 사이에 비활성화되는 시간입니다. */
private Cooldown destructionCooldown;
/**
* Constructor, establishes the ship's properties.
- *
+ * 생성자, 선박의 속성을 설정합니다.
+ *
* @param positionX
* Initial position of the ship in the X axis.
* @param positionY
@@ -46,6 +53,7 @@ public Ship(final int positionX, final int positionY) {
/**
* Moves the ship speed uni ts right, or until the right screen border is
* reached.
+ * 선박 속도 단위를 오른쪽으로 이동하거나 오른쪽 화면 경계에 도달할 때까지 변경합니다.
*/
public final void moveRight() {
this.positionX += SPEED;
@@ -54,6 +62,7 @@ public final void moveRight() {
/**
* Moves the ship speed units left, or until the left screen border is
* reached.
+ * 선박 속도 단위를 왼쪽으로 이동하거나 왼쪽 화면 경계에 도달할 때까지 변경합니다.
*/
public final void moveLeft() {
this.positionX -= SPEED;
@@ -61,9 +70,11 @@ public final void moveLeft() {
/**
* Shoots a bullet upwards.
- *
+ * 총알을 위로 쏩니다.
+ *
* @param bullets
* List of bullets on screen, to add the new bullet.
+ * 새 총알들을 추가하기 위한 화면의 총알들 List입니다.
* @return Checks if the bullet was shot correctly.
*/
public final boolean shoot(final Set bullets) {
@@ -78,6 +89,7 @@ public final boolean shoot(final Set bullets) {
/**
* Updates status of the ship.
+ * 선박의 상태를 업데이트합니다.
*/
public final void update() {
if (!this.destructionCooldown.checkFinished())
@@ -88,6 +100,7 @@ public final void update() {
/**
* Switches the ship to its destroyed state.
+ * 함선을 파괴된 상태로 전환합니다.
*/
public final void destroy() {
this.destructionCooldown.reset();
@@ -95,7 +108,8 @@ public final void destroy() {
/**
* Checks if the ship is destroyed.
- *
+ * 함선이 파괴되었는지 확인합니다.
+ *
* @return True if the ship is currently destroyed.
*/
public final boolean isDestroyed() {
@@ -104,7 +118,8 @@ public final boolean isDestroyed() {
/**
* Getter for the ship's speed.
- *
+ * 배의 속도에 대한 Getter.
+ *
* @return Speed of the ship.
*/
public final int getSpeed() {
diff --git a/src/screen/GameScreen.java b/src/screen/GameScreen.java
index 4e76259d0..c0baeceb2 100644
--- a/src/screen/GameScreen.java
+++ b/src/screen/GameScreen.java
@@ -17,79 +17,110 @@
/**
* Implements the game screen, where the action happens.
- *
+ * 액션이 발생하는 게임 화면을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class GameScreen extends Screen {
- /** Milliseconds until the screen accepts user input. */
+ /** Milliseconds until the screen accepts user input.
+ * 화면이 사용자 입력을 수락할 때까지의 시간(밀리초)입니다. */
private static final int INPUT_DELAY = 6000;
- /** Bonus score for each life remaining at the end of the level. */
+ /** Bonus score for each life remaining at the end of the level.
+ * 레벨이 끝날 때 남은 각 목숨에 대한 보너스 점수. */
private static final int LIFE_SCORE = 100;
- /** Minimum time between bonus ship's appearances. */
+ /** Minimum time between bonus ship's appearances.
+ * 보너스 함선의 출현 사이의 최소 시간. */
private static final int BONUS_SHIP_INTERVAL = 20000;
- /** Maximum variance in the time between bonus ship's appearances. */
+ /** Maximum variance in the time between bonus ship's appearances.
+ * 보너스 함선의 출현 사이의 최대 variance. */
private static final int BONUS_SHIP_VARIANCE = 10000;
- /** Time until bonus ship explosion disappears. */
+ /** Time until bonus ship explosion disappears.
+ * 보너스 함선 폭발이 사라질 때까지의 시간. */
private static final int BONUS_SHIP_EXPLOSION = 500;
- /** Time from finishing the level to screen change. */
+ /** Time from finishing the level to screen change.
+ * 레벨 완료 후 화면 변경까지의 시간입니다. */
private static final int SCREEN_CHANGE_INTERVAL = 1500;
- /** Height of the interface separation line. */
+ /** Height of the interface separation line.
+ * 인터페이스 분리선의 높이입니다. */
private static final int SEPARATION_LINE_HEIGHT = 40;
- /** Current game difficulty settings. */
+ /** Current game difficulty settings.
+ * 현재 게임 난이도 설정. */
private GameSettings gameSettings;
- /** Current difficulty level number. */
+ /** Current difficulty level number.
+ * 현재 난이도 번호입니다. */
private int level;
- /** Formation of enemy ships. */
+ /** Formation of enemy ships.
+ * 적 함선의 포메이션. */
private EnemyShipFormation enemyShipFormation;
- /** Player's ship. */
+ /** Player's ship.
+ * 플레이어의 함선. */
private Ship ship;
- /** Bonus enemy ship that appears sometimes. */
+ /** Bonus enemy ship that appears sometimes.
+ * 가끔 등장하는 보너스 적함. */
private EnemyShip enemyShipSpecial;
- /** Minimum time between bonus ship appearances. */
+ /** Minimum time between bonus ship appearances.
+ * 보너스 함선 출현 사이의 최소 시간. */
private Cooldown enemyShipSpecialCooldown;
- /** Time until bonus ship explosion disappears. */
+ /** Time until bonus ship explosion disappears.
+ * 보너스 함선 폭발이 사라질 때까지의 시간. */
private Cooldown enemyShipSpecialExplosionCooldown;
- /** Time from finishing the level to screen change. */
+ /** Time from finishing the level to screen change.
+ * 레벨 완료 후 화면 변경까지의 시간입니다. */
private Cooldown screenFinishedCooldown;
- /** Set of all bullets fired by on screen ships. */
+ /** Set of all bullets fired by on screen ships.
+ * 화면에서 발사한 모든 총알에 대한 설정입니다. */
private Set bullets;
- /** Current score. */
+ /** Current score.
+ * 현재 점수. */
private int score;
- /** Player lives left. */
+ /** Player lives left.
+ * 플레이어의 남은 목숨. */
private int lives;
- /** Total bullets shot by the player. */
+ /** Total bullets shot by the player.
+ * 플레이어가 쏜 전체 총알들입니다. */
private int bulletsShot;
- /** Total ships destroyed by the player. */
+ /** Total ships destroyed by the player.
+ * 플레이어가 파괴한 총 선박입니다. */
private int shipsDestroyed;
- /** Moment the game starts. */
+ /** Moment the game starts.
+ * 게임이 시작되는 순간. */
private long gameStartTime;
- /** Checks if the level is finished. */
+ /** Checks if the level is finished.
+ * 레벨이 완료되었는지 확인합니다. */
private boolean levelFinished;
- /** Checks if a bonus life is received. */
+ /** Checks if a bonus life is received.
+ * 보너스 목숨을 받았는지 확인합니다. */
private boolean bonusLife;
/**
* Constructor, establishes the properties of the screen.
- *
+ * 생성자, 화면의 속성을 설정합니다.
+ *
* @param gameState
* Current game state.
+ * 현재 게임 상태입니다.
* @param gameSettings
* Current game settings.
+ * 현재 게임 설정.
* @param bonnusLife
* Checks if a bonus life is awarded this level.
+ * 이 레벨에서 보너스 생명이 주어지는지 확인합니다.
* @param width
* Screen width.
+ * 화면 너비.
* @param height
* Screen height.
+ * 화면 높이.
* @param fps
* Frames per second, frame rate at which the game is run.
+ * 초당 프레임 수, 게임이 실행되는 프레임 속도입니다.
*/
public GameScreen(final GameState gameState,
- final GameSettings gameSettings, final boolean bonusLife,
- final int width, final int height, final int fps) {
+ final GameSettings gameSettings, final boolean bonusLife,
+ final int width, final int height, final int fps) {
super(width, height, fps);
this.gameSettings = gameSettings;
@@ -105,6 +136,7 @@ public GameScreen(final GameState gameState,
/**
* Initializes basic screen properties, and adds necessary elements.
+ * 기본 화면 속성을 초기화하고 필요한 요소를 추가합니다.
*/
public final void initialize() {
super.initialize();
@@ -129,7 +161,8 @@ public final void initialize() {
/**
* Starts the action.
- *
+ * 작업을 시작합니다.
+ *
* @return Next screen code.
*/
public final int run() {
@@ -143,6 +176,7 @@ public final int run() {
/**
* Updates the elements on screen and checks for events.
+ * 화면의 요소를 업데이트하고 이벤트를 확인합니다.
*/
protected final void update() {
super.update();
@@ -212,6 +246,7 @@ else if (this.enemyShipSpecialExplosionCooldown.checkFinished())
/**
* Draws the elements associated with the screen.
+ * 화면과 관련된 요소를 그립니다.
*/
private void draw() {
drawManager.initDrawing(this);
@@ -238,7 +273,7 @@ private void draw() {
if (!this.inputDelay.checkFinished()) {
int countdown = (int) ((INPUT_DELAY
- (System.currentTimeMillis()
- - this.gameStartTime)) / 1000);
+ - this.gameStartTime)) / 1000);
drawManager.drawCountDown(this, this.level, countdown,
this.bonusLife);
drawManager.drawHorizontalLine(this, this.height / 2 - this.height
@@ -252,6 +287,7 @@ private void draw() {
/**
* Cleans bullets that go off screen.
+ * 화면 밖으로 나가는 총알을 정리합니다.
*/
private void cleanBullets() {
Set recyclable = new HashSet();
@@ -267,6 +303,7 @@ private void cleanBullets() {
/**
* Manages collisions between bullets and ships.
+ * 총알과 선박 간의 충돌을 관리합니다.
*/
private void manageCollisions() {
Set recyclable = new HashSet();
@@ -306,12 +343,16 @@ && checkCollision(bullet, this.enemyShipSpecial)) {
/**
* Checks if two entities are colliding.
- *
+ * 두 엔터티가 충돌하는지 확인합니다.
+ *
* @param a
* First entity, the bullet.
+ * 첫 번째 엔티티, 총알.
* @param b
* Second entity, the ship.
+ * 두 번째 엔티티, 배.
* @return Result of the collision test.
+ * 충돌 테스트 결과를 반환.
*/
private boolean checkCollision(final Entity a, final Entity b) {
// Calculate center point of the entities in both axis.
@@ -331,7 +372,8 @@ private boolean checkCollision(final Entity a, final Entity b) {
/**
* Returns a GameState object representing the status of the game.
- *
+ * 게임의 상태를 나타내는 GameState 오브젝트를 반환합니다.
+ *
* @return Current game state.
*/
public final GameState getGameState() {
diff --git a/src/screen/HighScoreScreen.java b/src/screen/HighScoreScreen.java
index 56fbb4adc..4514119c9 100644
--- a/src/screen/HighScoreScreen.java
+++ b/src/screen/HighScoreScreen.java
@@ -9,24 +9,30 @@
/**
* Implements the high scores screen, it shows player records.
- *
+ * 고득점 화면을 구현하여 플레이어의 기록을 보여줍니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class HighScoreScreen extends Screen {
- /** List of past high scores. */
+ /** List of past high scores.
+ * 과거 최고 점수 List입니다. */
private List highScores;
/**
* Constructor, establishes the properties of the screen.
- *
+ * 생성자, 화면의 속성을 설정합니다.
+ *
* @param width
* Screen width.
+ * 화면 너비.
* @param height
* Screen height.
+ * 화면 높이.
* @param fps
* Frames per second, frame rate at which the game is run.
+ * 초당 프레임 수, 게임이 실행되는 프레임 속도입니다.
*/
public HighScoreScreen(final int width, final int height, final int fps) {
super(width, height, fps);
@@ -42,7 +48,7 @@ public HighScoreScreen(final int width, final int height, final int fps) {
/**
* Starts the action.
- *
+ *
* @return Next screen code.
*/
public final int run() {
@@ -53,6 +59,7 @@ public final int run() {
/**
* Updates the elements on screen and checks for events.
+ * 화면의 요소를 업데이트하고 이벤트를 확인합니다.
*/
protected final void update() {
super.update();
@@ -65,6 +72,7 @@ protected final void update() {
/**
* Draws the elements associated with the screen.
+ * 화면과 관련된 요소를 그립니다.
*/
private void draw() {
drawManager.initDrawing(this);
diff --git a/src/screen/ScoreScreen.java b/src/screen/ScoreScreen.java
index ff215715d..28e11759f 100644
--- a/src/screen/ScoreScreen.java
+++ b/src/screen/ScoreScreen.java
@@ -12,43 +12,58 @@
/**
* Implements the score screen.
- *
+ * 점수 화면을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class ScoreScreen extends Screen {
- /** Milliseconds between changes in user selection. */
+ /** Milliseconds between changes in user selection.
+ * 사용자 선택 변경 사이의 밀리초입니다. */
private static final int SELECTION_TIME = 200;
- /** Maximum number of high scores. */
+ /** Maximum number of high scores.
+ * 최고 점수의 최대 수입니다. */
private static final int MAX_HIGH_SCORE_NUM = 7;
- /** Code of first mayus character. */
+ /** Code of first mayus character.
+ * 첫 번째 Mayus 문자의 코드입니다. */
private static final int FIRST_CHAR = 65;
- /** Code of last mayus character. */
+ /** Code of last mayus character.
+ * 마지막 Mayus 문자의 코드입니다. */
private static final int LAST_CHAR = 90;
- /** Current score. */
+ /** Current score.
+ * 현재 점수. */
private int score;
- /** Player lives left. */
+ /** Player lives left.
+ * 플레이어의 남은 목숨. */
private int livesRemaining;
- /** Total bullets shot by the player. */
+ /** Total bullets shot by the player.
+ * 플레이어가 쏜 전체 총알입니다. */
private int bulletsShot;
- /** Total ships destroyed by the player. */
+ /** Total ships destroyed by the player.
+ * 플레이어가 파괴한 총 선박입니다. */
private int shipsDestroyed;
- /** List of past high scores. */
+ /** List of past high scores.
+ * 과거 최고 점수 List입니다. */
private List highScores;
- /** Checks if current score is a new high score. */
+ /** Checks if current score is a new high score.
+ * 현재 점수가 새로운 최고 점수인지 확인합니다. */
private boolean isNewRecord;
- /** Player name for record input. */
+ /** Player name for record input.
+ * 레코드 입력을 위한 플레이어 이름입니다. */
private char[] name;
- /** Character of players name selected for change. */
+ /** Character of players name selected for change.
+ * 변경을 위해 선택된 플레이어 이름의 캐릭터. */
private int nameCharSelected;
- /** Time between changes in user selection. */
+ /** Time between changes in user selection.
+ * 사용자 선택 변경 사이의 시간입니다. */
private Cooldown selectionCooldown;
/**
* Constructor, establishes the properties of the screen.
- *
+ * 생성자, 화면의 속성을 설정합니다.
+ *
* @param width
* Screen width.
* @param height
@@ -59,7 +74,7 @@ public class ScoreScreen extends Screen {
* Current game state.
*/
public ScoreScreen(final int width, final int height, final int fps,
- final GameState gameState) {
+ final GameState gameState) {
super(width, height, fps);
this.score = gameState.getScore();
@@ -86,7 +101,7 @@ public ScoreScreen(final int width, final int height, final int fps,
/**
* Starts the action.
- *
+ *
* @return Next screen code.
*/
public final int run() {
@@ -97,6 +112,7 @@ public final int run() {
/**
* Updates the elements on screen and checks for events.
+ * 화면의 요소를 업데이트하고 이벤트를 확인합니다.
*/
protected final void update() {
super.update();
@@ -132,14 +148,14 @@ protected final void update() {
this.name[this.nameCharSelected] =
(char) (this.name[this.nameCharSelected]
== LAST_CHAR ? FIRST_CHAR
- : this.name[this.nameCharSelected] + 1);
+ : this.name[this.nameCharSelected] + 1);
this.selectionCooldown.reset();
}
if (inputManager.isKeyDown(KeyEvent.VK_DOWN)) {
this.name[this.nameCharSelected] =
(char) (this.name[this.nameCharSelected]
== FIRST_CHAR ? LAST_CHAR
- : this.name[this.nameCharSelected] - 1);
+ : this.name[this.nameCharSelected] - 1);
this.selectionCooldown.reset();
}
}
@@ -149,6 +165,7 @@ protected final void update() {
/**
* Saves the score as a high score.
+ * 점수를 높은 점수로 저장합니다.
*/
private void saveScore() {
highScores.add(new Score(new String(this.name), score));
@@ -165,6 +182,7 @@ private void saveScore() {
/**
* Draws the elements associated with the screen.
+ * 화면과 관련된 요소를 그립니다.
*/
private void draw() {
drawManager.initDrawing(this);
diff --git a/src/screen/Screen.java b/src/screen/Screen.java
index b972559ad..ad01a493e 100644
--- a/src/screen/Screen.java
+++ b/src/screen/Screen.java
@@ -11,13 +11,15 @@
/**
* Implements a generic screen.
- *
+ * 일반 화면을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class Screen {
-
- /** Milliseconds until the screen accepts user input. */
+
+ /** Milliseconds until the screen accepts user input.
+ * 화면이 사용자 입력을 수락할 때까지의 시간(밀리초)입니다. */
private static final int INPUT_DELAY = 1000;
/** Draw Manager instance. */
@@ -31,21 +33,27 @@ public class Screen {
protected int width;
/** Screen height. */
protected int height;
- /** Frames per second shown on the screen. */
+ /** Frames per second shown on the screen.
+ * 화면에 표시되는 초당 프레임 수입니다. */
protected int fps;
- /** Screen insets. */
+ /** Screen insets.
+ * 화면 삽입. */
protected Insets insets;
- /** Time until the screen accepts user input. */
+ /** Time until the screen accepts user input.
+ * 화면이 사용자 입력을 수락할 때까지의 시간입니다. */
protected Cooldown inputDelay;
- /** If the screen is running. */
+ /** If the screen is running.
+ * 화면이 실행 중인 경우. */
protected boolean isRunning;
- /** What kind of screen goes next. */
+ /** What kind of screen goes next.
+ * 다음은 어떤 종류의 화면으로 갈지. */
protected int returnCode;
/**
* Constructor, establishes the properties of the screen.
- *
+ * 생성자, 화면의 속성을 설정합니다.
+ *
* @param width
* Screen width.
* @param height
@@ -68,6 +76,7 @@ public Screen(final int width, final int height, final int fps) {
/**
* Initializes basic screen properties.
+ * 기본 화면 속성을 초기화합니다.
*/
public void initialize() {
@@ -75,7 +84,8 @@ public void initialize() {
/**
* Activates the screen.
- *
+ * 화면을 활성화합니다.
+ *
* @return Next screen code.
*/
public int run() {
@@ -101,13 +111,15 @@ public int run() {
/**
* Updates the elements on screen and checks for events.
+ * 화면의 요소를 업데이트하고 이벤트를 확인합니다.
*/
protected void update() {
}
/**
* Getter for screen width.
- *
+ * 화면 너비에 대한 Getter.
+ *
* @return Screen width.
*/
public final int getWidth() {
@@ -116,7 +128,8 @@ public final int getWidth() {
/**
* Getter for screen height.
- *
+ * 화면 높이에 대한 Getter.
+ *
* @return Screen height.
*/
public final int getHeight() {
diff --git a/src/screen/TitleScreen.java b/src/screen/TitleScreen.java
index a8229b463..d8f2bc677 100644
--- a/src/screen/TitleScreen.java
+++ b/src/screen/TitleScreen.java
@@ -7,21 +7,25 @@
/**
* Implements the title screen.
- *
+ * 타이틀 화면을 구현합니다.
+ *
* @author Roberto Izquierdo Amo
- *
+ *
*/
public class TitleScreen extends Screen {
- /** Milliseconds between changes in user selection. */
+ /** Milliseconds between changes in user selection.
+ * 사용자 선택 변경 사이의 밀리초입니다. */
private static final int SELECTION_TIME = 200;
-
- /** Time between changes in user selection. */
+
+ /** Time between changes in user selection.
+ * 사용자 선택 변경 사이의 시간입니다. */
private Cooldown selectionCooldown;
/**
* Constructor, establishes the properties of the screen.
- *
+ * 생성자, 화면의 속성을 설정합니다.
+ *
* @param width
* Screen width.
* @param height
@@ -40,7 +44,7 @@ public TitleScreen(final int width, final int height, final int fps) {
/**
* Starts the action.
- *
+ *
* @return Next screen code.
*/
public final int run() {
@@ -51,6 +55,7 @@ public final int run() {
/**
* Updates the elements on screen and checks for events.
+ * 화면의 요소를 업데이트하고 이벤트를 확인합니다.
*/
protected final void update() {
super.update();
@@ -75,6 +80,7 @@ protected final void update() {
/**
* Shifts the focus to the next menu item.
+ * 포커스를 다음 메뉴 항목으로 이동합니다.
*/
private void nextMenuItem() {
if (this.returnCode == 3)
@@ -87,6 +93,7 @@ else if (this.returnCode == 0)
/**
* Shifts the focus to the previous menu item.
+ * 포커스를 이전 메뉴 항목으로 이동합니다.
*/
private void previousMenuItem() {
if (this.returnCode == 0)
@@ -99,6 +106,7 @@ else if (this.returnCode == 2)
/**
* Draws the elements associated with the screen.
+ * 화면과 관련된 요소를 그립니다.
*/
private void draw() {
drawManager.initDrawing(this);