diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3149cbc27..63f16543d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,15 +1,21 @@ - - - + + + + + + + + + - + @@ -33,103 +39,109 @@ - - + + - - + + - - - - + + + + - - + + - + - - + - - + + - - + + - - + - - + + - - - + + + + + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - - + + + + + + + + @@ -137,8 +149,8 @@ - - + + @@ -170,15 +182,19 @@ @@ -312,6 +328,22 @@ + + + + + + + + + + + + + + + + @@ -516,7 +548,7 @@ - @@ -564,27 +602,27 @@ - + - + - - - + + + - - + + + - + - @@ -600,11 +638,12 @@ - - @@ -613,15 +652,15 @@ \ No newline at end of file diff --git a/src/engine/Constants.java b/src/engine/Constants.java new file mode 100644 index 000000000..46ce7fe3d --- /dev/null +++ b/src/engine/Constants.java @@ -0,0 +1,9 @@ +package engine; + +/** + * Created by Ryan on 7/28/2015. + */ +public class Constants { + /** Max lives. */ + public static final int MAX_LIVES = 3; +} diff --git a/src/engine/DrawManager.java b/src/engine/DrawManager.java index 5d21b1af5..60e0b7eeb 100644 --- a/src/engine/DrawManager.java +++ b/src/engine/DrawManager.java @@ -82,8 +82,8 @@ public enum SpriteType { * Private constructor. */ private DrawManager() { - fileManager = Core.getFileManager(); - logger = Core.getLogger(); + fileManager = Main.getFileManager(); + logger = Main.getLogger(); logger.info("Started loading resources."); try { diff --git a/src/engine/FileManager.java b/src/engine/FileManager.java index 42ab4754b..ffee5ff6e 100644 --- a/src/engine/FileManager.java +++ b/src/engine/FileManager.java @@ -42,7 +42,7 @@ public final class FileManager { * private constructor. */ private FileManager() { - logger = Core.getLogger(); + logger = Main.getLogger(); } /** diff --git a/src/engine/Frame.java b/src/engine/Frame.java index b34bd8f83..7a8f8569b 100644 --- a/src/engine/Frame.java +++ b/src/engine/Frame.java @@ -43,7 +43,7 @@ public Frame(final int width, final int height) { this.height = height - insets.top + insets.bottom; setTitle("Invaders"); - addKeyListener(Core.getInputManager()); + addKeyListener(Main.getInputManager()); } /** @@ -54,14 +54,14 @@ public Frame(final int width, final int height) { * @return Return code of the finished screen. */ public final ScreenType setScreen(final Screen screen) { - Core.getLogger().info("Starting " + screen.getScreenType() + " " + Core.WIDTH + "x" + Core.HEIGHT + - " at " + Core.FPS + " fps."); + Main.getLogger().info("Starting " + screen.getScreenType() + " " + Main.WIDTH + "x" + Main.HEIGHT + + " at " + Main.FPS + " fps."); currentScreen = screen; currentScreen.initialize(); ScreenType nextScreen = currentScreen.run(); - Core.getLogger().info("Closing " + screen.getScreenType() + "."); + Main.getLogger().info("Closing " + screen.getScreenType() + "."); return nextScreen; } diff --git a/src/engine/GameState.java b/src/engine/GameState.java index 03fe4ebe8..c7f3006b1 100644 --- a/src/engine/GameState.java +++ b/src/engine/GameState.java @@ -46,16 +46,25 @@ public GameState(final int level, final int score, /** * @return the level */ - public final int getLevel() { - return level; - } + public final int getLevel() {return level; } + + /** + * Sets a new level + * @param newLevel + */ + public final void setLevel(int newLevel) { this.level = newLevel; } /** * @return the score */ - public final int getScore() { - return score; - } + public final int getScore() { return score; } + + /** + * Sets a new score + * @param newScore + * @return + */ + public final void setScore(int newScore) { this.score = newScore; } /** * @return the livesRemaining @@ -64,12 +73,22 @@ public final int getLivesRemaining() { return livesRemaining; } + /** + * Set new lives remaining + * @param newLivesRemaining + */ + public final void setLivesRemaining(int newLivesRemaining) { this.livesRemaining = newLivesRemaining; } + /** * @return the bulletsShot */ - public final int getBulletsShot() { - return bulletsShot; - } + public final int getBulletsShot() { return bulletsShot; } + + /** + * Set bullets shot + * @param bulletsShot + */ + public void setBulletsShot(int bulletsShot) { this.bulletsShot = bulletsShot; } /** * @return the shipsDestroyed @@ -78,4 +97,10 @@ public final int getShipsDestroyed() { return shipsDestroyed; } + /** + * Set ships destroyed + * @param shipsDestroyed + */ + public void setShipsDestroyed(int shipsDestroyed) { this.shipsDestroyed = shipsDestroyed; } + } diff --git a/src/engine/Invaders.java b/src/engine/Invaders.java new file mode 100644 index 000000000..6dc4d632e --- /dev/null +++ b/src/engine/Invaders.java @@ -0,0 +1,57 @@ +package engine; + +import screen.*; + +import java.util.List; + +/** + * Created by Ryan on 7/28/2015. + */ +public class Invaders { + + /** + * Start running the game + */ + public static void run(Frame frame) { + // Get the size of the frame + int width = frame.getWidth(); + int height = frame.getHeight(); + + // Get a list of levels to play + List levelSettings = Levels.getLevels(); + + // Hold on to all of the game's information + GameState gameState; + + // The current screen + // Empty by default + Screen currentScreen; + + // Start at the title screen + ScreenType nextScreen = ScreenType.TitleScreen; + + while (nextScreen != ScreenType.EndGame) { + // Reset the game's state each time the game starts over + gameState = new GameState(1, 0, Constants.MAX_LIVES, 0, 0); + + if(nextScreen == ScreenType.TitleScreen) { + // Main menu. + currentScreen = new TitleScreen(width, height, Main.FPS); + nextScreen = frame.setScreen(currentScreen); + } + else if (nextScreen == ScreenType.GameScreen) { + currentScreen = new GameScreen(gameState, levelSettings, width, height, Main.FPS); + frame.setScreen(currentScreen); + + currentScreen = new ScoreScreen(width, height, Main.FPS, gameState); + nextScreen = frame.setScreen(currentScreen); + } + else if (nextScreen == ScreenType.HighScroreScreen) { + // High scores. + currentScreen = new HighScoreScreen(width, height, Main.FPS); + nextScreen = frame.setScreen(currentScreen); + } + + } + } +} diff --git a/src/engine/Core.java b/src/engine/Main.java similarity index 56% rename from src/engine/Core.java rename to src/engine/Main.java index 71fee1425..697c70718 100644 --- a/src/engine/Core.java +++ b/src/engine/Main.java @@ -1,6 +1,5 @@ package engine; -import java.util.ArrayList; import java.util.List; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; @@ -20,8 +19,7 @@ * @author Roberto Izquierdo Amo * */ -public final class Core { - +public final class Main { /** Width of current screen. */ public static final int WIDTH = 448; /** Height of current screen. */ @@ -29,21 +27,10 @@ public final class Core { /** Max fps of current screen. */ public static final int FPS = 60; - /** Max lives. */ - private static final int MAX_LIVES = 3; - /** Levels between extra life. */ - private static final int EXTRA_LIFE_FRECUENCY = 3; - /** Total number of levels. */ - private static final int NUM_LEVELS = 7; - /** Frame to draw the screen on. */ private static Frame frame; - /** Screen currently shown. */ - private static Screen currentScreen; - /** Difficulty settings list. */ - private static List gameSettings; /** Application logger. */ - private static final Logger LOGGER = Logger.getLogger(Core.class + private static final Logger LOGGER = Logger.getLogger(Main.class .getSimpleName()); /** Logger handler for printing to disk. */ private static Handler fileHandler; @@ -78,81 +65,19 @@ public static void main(final String[] args) { frame = new Frame(WIDTH, HEIGHT); DrawManager.getInstance().setFrame(frame); - int width = frame.getWidth(); - int height = frame.getHeight(); // Run the game - run(width, height); + Invaders.run(frame); fileHandler.flush(); fileHandler.close(); System.exit(0); } - /** - * Start running the game - * @param width - * @param height - */ - public static void run(int width, int height) { - // Get a list of levels to play - gameSettings = Levels.getLevels(); - - // Hold on to all of the game's information - GameState gameState; - - // Start at the title screen - ScreenType nextScreen = ScreenType.TitleScreen; - - do { - // Reset the game's state each time the game starts over - gameState = new GameState(1, 0, MAX_LIVES, 0, 0); - - if(nextScreen == ScreenType.TitleScreen) { - // Main menu. - currentScreen = new TitleScreen(width, height, FPS); - nextScreen = frame.setScreen(currentScreen); - } - else if (nextScreen == ScreenType.GameScreen) { - // Game & score. - do { - // One extra life 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); - frame.setScreen(currentScreen); - - 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); - - currentScreen = new ScoreScreen(width, height, FPS, gameState); - nextScreen = frame.setScreen(currentScreen); - } - else if (nextScreen == ScreenType.HighScroreScreen) { - // High scores. - currentScreen = new HighScoreScreen(width, height, FPS); - nextScreen = frame.setScreen(currentScreen); - } - - } while (nextScreen != ScreenType.EndGame); - } - /** * Constructor, not called. */ - private Core() { + private Main() { } diff --git a/src/entity/EnemyShip.java b/src/entity/EnemyShip.java index 19d9958ad..8c01ac4cc 100644 --- a/src/entity/EnemyShip.java +++ b/src/entity/EnemyShip.java @@ -3,7 +3,7 @@ import java.awt.Color; import engine.Cooldown; -import engine.Core; +import engine.Main; import engine.DrawManager.SpriteType; /** @@ -45,7 +45,7 @@ public EnemyShip(final int positionX, final int positionY, super(positionX, positionY, 12 * 2, 8 * 2, Color.WHITE); this.spriteType = spriteType; - this.animationCooldown = Core.getCooldown(500); + this.animationCooldown = Main.getCooldown(500); this.isDestroyed = false; switch (this.spriteType) { diff --git a/src/entity/EnemyShipFormation.java b/src/entity/EnemyShipFormation.java index 04bf96326..721da4cad 100644 --- a/src/entity/EnemyShipFormation.java +++ b/src/entity/EnemyShipFormation.java @@ -9,7 +9,7 @@ import screen.Screen; import engine.Cooldown; -import engine.Core; +import engine.Main; import engine.DrawManager; import engine.DrawManager.SpriteType; import engine.GameSettings; @@ -112,8 +112,8 @@ private enum Direction { * Current game settings. */ public EnemyShipFormation(final GameSettings gameSettings) { - this.drawManager = Core.getDrawManager(); - this.logger = Core.getLogger(); + this.drawManager = Main.getDrawManager(); + this.logger = Main.getLogger(); this.enemyShips = new ArrayList>(); this.currentDirection = Direction.RIGHT; this.movementInterval = 0; @@ -191,7 +191,7 @@ public final void draw() { */ public final void update() { if(this.shootingCooldown == null) { - this.shootingCooldown = Core.getVariableCooldown(shootingInterval, + this.shootingCooldown = Main.getVariableCooldown(shootingInterval, shootingVariance); this.shootingCooldown.reset(); } diff --git a/src/entity/Ship.java b/src/entity/Ship.java index fd007fde1..6e7830ab9 100644 --- a/src/entity/Ship.java +++ b/src/entity/Ship.java @@ -4,7 +4,7 @@ import java.util.Set; import engine.Cooldown; -import engine.Core; +import engine.Main; import engine.DrawManager.SpriteType; /** @@ -39,8 +39,8 @@ public Ship(final int positionX, final int positionY) { super(positionX, positionY, 13 * 2, 8 * 2, Color.GREEN); this.spriteType = SpriteType.Ship; - this.shootingCooldown = Core.getCooldown(SHOOTING_INTERVAL); - this.destructionCooldown = Core.getCooldown(1000); + this.shootingCooldown = Main.getCooldown(SHOOTING_INTERVAL); + this.destructionCooldown = Main.getCooldown(1000); } /** diff --git a/src/screen/GameScreen.java b/src/screen/GameScreen.java index de7fca51a..3b47d3f32 100644 --- a/src/screen/GameScreen.java +++ b/src/screen/GameScreen.java @@ -2,6 +2,7 @@ import java.awt.event.KeyEvent; import java.util.HashSet; +import java.util.List; import java.util.Set; import engine.*; @@ -20,6 +21,9 @@ */ public class GameScreen extends Screen { + /** Levels between extra life. */ + private static final int EXTRA_LIFE_FRECUENCY = 3; + /** 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. */ @@ -36,9 +40,7 @@ public class GameScreen extends Screen { private static final int SEPARATION_LINE_HEIGHT = 40; /** Current game difficulty settings. */ - private GameSettings gameSettings; - /** Current difficulty level number. */ - private int level; + private List levelSettings; /** Formation of enemy ships. */ private EnemyShipFormation enemyShipFormation; /** Player's ship. */ @@ -53,14 +55,8 @@ public class GameScreen extends Screen { private Cooldown screenFinishedCooldown; /** Set of all bullets fired by on screen ships. */ private Set bullets; - /** Current score. */ - private int score; - /** Player lives left. */ - private int lives; - /** Total bullets shot by the player. */ - private int bulletsShot; - /** Total ships destroyed by the player. */ - private int shipsDestroyed; + /** Game's state. */ + private GameState gameState; /** Moment the game starts. */ private long gameStartTime; /** Checks if the level is finished. */ @@ -73,10 +69,8 @@ public class GameScreen extends Screen { * * @param gameState * Current game state. - * @param gameSettings + * @param levelSettings * Current game settings. - * @param bonusLife - * Checks if a bonus life is awarded this level. * @param width * Screen width. * @param height @@ -85,19 +79,13 @@ public class GameScreen extends Screen { * Frames per second, frame rate at which the game is run. */ public GameScreen(final GameState gameState, - final GameSettings gameSettings, final boolean bonusLife, + final List levelSettings, final int width, final int height, final int fps) { super(width, height, fps); - this.gameSettings = gameSettings; - this.bonusLife = bonusLife; - this.level = gameState.getLevel(); - this.score = gameState.getScore(); - this.lives = gameState.getLivesRemaining(); - if (this.bonusLife) - this.lives++; - this.bulletsShot = gameState.getBulletsShot(); - this.shipsDestroyed = gameState.getShipsDestroyed(); + this.gameState = gameState; + this.levelSettings = levelSettings; + this.bonusLife = false; } /** @@ -112,22 +100,26 @@ public GameScreen(final GameState gameState, public final void initialize() { super.initialize(); - enemyShipFormation = new EnemyShipFormation(this.gameSettings); + enemyShipFormation = new EnemyShipFormation(this.levelSettings.get(this.gameState.getLevel()- 1)); enemyShipFormation.attach(this); this.ship = new Ship(this.width / 2, this.height - 30); // Appears each 10-30 seconds. - this.enemyShipSpecialCooldown = Core.getVariableCooldown( + this.enemyShipSpecialCooldown = Main.getVariableCooldown( BONUS_SHIP_INTERVAL, BONUS_SHIP_VARIANCE); this.enemyShipSpecialCooldown.reset(); - this.enemyShipSpecialExplosionCooldown = Core + this.enemyShipSpecialExplosionCooldown = Main .getCooldown(BONUS_SHIP_EXPLOSION); - this.screenFinishedCooldown = Core.getCooldown(SCREEN_CHANGE_INTERVAL); + this.screenFinishedCooldown = Main.getCooldown(SCREEN_CHANGE_INTERVAL); this.bullets = new HashSet(); // Special input delay / countdown. this.gameStartTime = System.currentTimeMillis(); - this.inputDelay = Core.getCooldown(INPUT_DELAY); + this.inputDelay = Main.getCooldown(INPUT_DELAY); this.inputDelay.reset(); + + + this.levelFinished = false; + this.screenFinishedCooldown.reset(); } /** @@ -137,10 +129,6 @@ public final void initialize() { */ public final ScreenType run() { super.run(); - - this.score += LIFE_SCORE * (this.lives - 1); - this.logger.info("Screen cleared with a score of " + this.score); - return this.nextScreen; } @@ -171,7 +159,7 @@ protected final void update() { } if (inputManager.isKeyDown(KeyEvent.VK_SPACE)) if (this.ship.shoot(this.bullets)) - this.bulletsShot++; + this.gameState.setBulletsShot(this.gameState.getBulletsShot() + 1); } if (this.enemyShipSpecial != null) { @@ -202,15 +190,36 @@ else if (this.enemyShipSpecialExplosionCooldown.checkFinished()) cleanBullets(); draw(); - if ((this.enemyShipFormation.isEmpty() || this.lives == 0) + if ((this.enemyShipFormation.isEmpty() || this.gameState.getLivesRemaining() == 0) && !this.levelFinished) { this.levelFinished = true; this.screenFinishedCooldown.reset(); } - if (this.levelFinished && this.screenFinishedCooldown.checkFinished()) - this.isRunning = false; + // If this level is over start the next level + if (this.levelFinished && this.screenFinishedCooldown.checkFinished()) { + // One extra life every few levels. + this.bonusLife = this.gameState.getLevel() + % EXTRA_LIFE_FRECUENCY == 0 + && this.gameState.getLivesRemaining() < Constants.MAX_LIVES; + + // Move on to the next level + this.gameState.setLevel(this.gameState.getLevel() + 1); + + // Reset this screen + this.initialize(); + + // Update the score + int newScore = this.gameState.getScore() + LIFE_SCORE * (this.gameState.getLivesRemaining() - 1); + this.gameState.setScore(newScore); + + this.logger.info("Screen cleared with a score of " + this.gameState.getScore()); + + // If the player doenst have anymore lives or they beat the last level, stop running the game screen + if(this.gameState.getLivesRemaining() <= 0 || this.gameState.getLevel()>= this.levelSettings.size()) + this.isRunning = false; + } } /** @@ -233,8 +242,8 @@ private void draw() { bullet.getPositionY()); // Interface. - drawManager.drawScore(this, this.score); - drawManager.drawLives(this, this.lives); + drawManager.drawScore(this, this.gameState.getScore()); + drawManager.drawLives(this, this.gameState.getLivesRemaining()); drawManager.drawHorizontalLine(this, SEPARATION_LINE_HEIGHT - 1); // Countdown to game start. @@ -242,7 +251,7 @@ private void draw() { int countdown = (int) ((INPUT_DELAY - (System.currentTimeMillis() - this.gameStartTime)) / 1000); - drawManager.drawCountDown(this, this.level, countdown, + drawManager.drawCountDown(this, this.gameState.getLevel(), countdown, this.bonusLife); drawManager.drawHorizontalLine(this, this.height / 2 - this.height / 12); @@ -279,8 +288,8 @@ private void manageCollisions() { recyclable.add(bullet); if (!this.ship.isDestroyed()) { this.ship.destroy(); - this.lives--; - this.logger.info("Hit on player ship, " + this.lives + this.gameState.setLivesRemaining(this.gameState.getLivesRemaining() - 1); + this.logger.info("Hit on player ship, " + this.gameState.getLivesRemaining() + " lives remaining."); } } @@ -288,16 +297,16 @@ private void manageCollisions() { for (EnemyShip enemyShip : this.enemyShipFormation) if (!enemyShip.isDestroyed() && checkCollision(bullet, enemyShip)) { - this.score += enemyShip.getPointValue(); - this.shipsDestroyed++; + this.gameState.setScore(this.gameState.getScore() + enemyShip.getPointValue()); + this.gameState.setShipsDestroyed(this.gameState.getShipsDestroyed() + 1); this.enemyShipFormation.destroy(enemyShip); recyclable.add(bullet); } if (this.enemyShipSpecial != null && !this.enemyShipSpecial.isDestroyed() && checkCollision(bullet, this.enemyShipSpecial)) { - this.score += this.enemyShipSpecial.getPointValue(); - this.shipsDestroyed++; + this.gameState.setScore(this.gameState.getScore() + this.enemyShipSpecial.getPointValue()); + this.gameState.setShipsDestroyed(this.gameState.getShipsDestroyed() + 1); this.enemyShipSpecial.destroy(); this.enemyShipSpecialExplosionCooldown.reset(); recyclable.add(bullet); @@ -331,14 +340,4 @@ private boolean checkCollision(final Entity a, final Entity b) { return distanceX < maxDistanceX && distanceY < maxDistanceY; } - - /** - * Returns a GameState object representing the status of the game. - * - * @return Current game state. - */ - public final GameState getGameState() { - return new GameState(this.level, this.score, this.lives, - this.bulletsShot, this.shipsDestroyed); - } } \ No newline at end of file diff --git a/src/screen/HighScoreScreen.java b/src/screen/HighScoreScreen.java index dc625e0d2..c6a137b43 100644 --- a/src/screen/HighScoreScreen.java +++ b/src/screen/HighScoreScreen.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.util.List; -import engine.Core; +import engine.Main; import engine.Score; import engine.ScreenType; @@ -35,7 +35,7 @@ public HighScoreScreen(final int width, final int height, final int fps) { this.nextScreen = ScreenType.TitleScreen; try { - this.highScores = Core.getFileManager().loadHighScores(); + this.highScores = Main.getFileManager().loadHighScores(); } catch (NumberFormatException | IOException e) { logger.warning("Couldn't load high scores!"); } diff --git a/src/screen/ScoreScreen.java b/src/screen/ScoreScreen.java index 8f9a3a001..9f9695364 100644 --- a/src/screen/ScoreScreen.java +++ b/src/screen/ScoreScreen.java @@ -66,11 +66,11 @@ public ScoreScreen(final int width, final int height, final int fps, this.isNewRecord = false; this.name = "AAA".toCharArray(); this.nameCharSelected = 0; - this.selectionCooldown = Core.getCooldown(SELECTION_TIME); + this.selectionCooldown = Main.getCooldown(SELECTION_TIME); this.selectionCooldown.reset(); try { - this.highScores = Core.getFileManager().loadHighScores(); + this.highScores = Main.getFileManager().loadHighScores(); if (highScores.size() < MAX_HIGH_SCORE_NUM || highScores.get(highScores.size() - 1).getScore() < this.score) @@ -93,7 +93,7 @@ public ScoreScreen(final int width, final int height, final int fps, * @return Next screen code. */ public final ScreenType run() { - Core.getLogger().info("Score info: " + Main.getLogger().info("Score info: " + this.score + ", " + this.livesRemaining + " lives remaining, " + this.bulletsShot + " bullets shot and " @@ -166,7 +166,7 @@ private void saveScore() { highScores.remove(highScores.size() - 1); try { - Core.getFileManager().saveHighScores(highScores); + Main.getFileManager().saveHighScores(highScores); } catch (IOException e) { logger.warning("Couldn't load high scores!"); } diff --git a/src/screen/Screen.java b/src/screen/Screen.java index bf24f285d..0f61aac1a 100644 --- a/src/screen/Screen.java +++ b/src/screen/Screen.java @@ -55,10 +55,10 @@ public Screen(final int width, final int height, final int fps) { this.height = height; this.fps = fps; - this.drawManager = Core.getDrawManager(); - this.inputManager = Core.getInputManager(); - this.logger = Core.getLogger(); - this.inputDelay = Core.getCooldown(INPUT_DELAY); + this.drawManager = Main.getDrawManager(); + this.inputManager = Main.getInputManager(); + this.logger = Main.getLogger(); + this.inputDelay = Main.getCooldown(INPUT_DELAY); this.inputDelay.reset(); this.nextScreen = ScreenType.EndGame; } diff --git a/src/screen/TitleScreen.java b/src/screen/TitleScreen.java index 55a7f8312..1a5c07ad6 100644 --- a/src/screen/TitleScreen.java +++ b/src/screen/TitleScreen.java @@ -3,7 +3,7 @@ import java.awt.event.KeyEvent; import engine.Cooldown; -import engine.Core; +import engine.Main; import engine.ScreenType; /** @@ -35,7 +35,7 @@ public TitleScreen(final int width, final int height, final int fps) { // Defaults to play. this.nextScreen = ScreenType.GameScreen; - this.selectionCooldown = Core.getCooldown(SELECTION_TIME); + this.selectionCooldown = Main.getCooldown(SELECTION_TIME); this.selectionCooldown.reset(); }