diff --git a/res/levels/test.level b/res/levels/test.level index 1d18609..1203ecb 100644 --- a/res/levels/test.level +++ b/res/levels/test.level @@ -1,4 +1,3 @@ - name:Testlevel \o/ backgroundMusic:music/ScooterFriendsTurbo8Bit.wav background:CloudBackground diff --git a/src/de/teamteamteam/spacescooter/GameFrame.java b/src/de/teamteamteam/spacescooter/GameFrame.java index 2a15eb7..fa2973d 100644 --- a/src/de/teamteamteam/spacescooter/GameFrame.java +++ b/src/de/teamteamteam/spacescooter/GameFrame.java @@ -158,6 +158,7 @@ public class GameFrame extends JFrame { * Apply rendering hints to the given Graphics2D. * KEY_ANTIALIASING is very expensive and doesn't do much more over KEY_TEXT_ANTIALIASING */ + @SuppressWarnings("unused") private void applyRenderingHints(Graphics2D bufferedGraphics) { if(GameConfig.keyAntialiasing == true) { bufferedGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); diff --git a/src/de/teamteamteam/spacescooter/brain/GameConfig.java b/src/de/teamteamteam/spacescooter/brain/GameConfig.java index 1ff68fb..6b2e983 100644 --- a/src/de/teamteamteam/spacescooter/brain/GameConfig.java +++ b/src/de/teamteamteam/spacescooter/brain/GameConfig.java @@ -2,8 +2,9 @@ package de.teamteamteam.spacescooter.brain; /** * This static class contains important game configuration. + * Contains initial constant values only. */ -public class GameConfig { +public final class GameConfig { /** * Whether debug output (and more) is enabled or disabled. @@ -13,47 +14,69 @@ public class GameConfig { /** * Width of GameWindow. */ - public static int windowWidth = 800; + public static final int windowWidth = 800; /** * Height of GameWindow. */ - public static int windowHeight = 650; + public static final int windowHeight = 650; + + /** + * Offset where the X=0 coordinate of the actual game screen starts. + */ + public static final int gameScreenXOffset = 0; + + /** + * Offset where the Y=0 coordinate of the actual game screen starts. + * This is currently influenced by the 50px interface bar at the top. + */ + public static final int gameScreenYOffset = 50; + + /** + * Actual width of the game screen. + */ + public static final int gameScreenWidth = GameConfig.windowWidth; + + /** + * Actual height of the game screen. + * This is currently influenced by the 50px interface bar at the top. + */ + public static final int gameScreenHeight = GameConfig.windowHeight - 50; /** * Title of the game window. */ - public static String windowTitle = "SpaceScooter!"; + public static final String windowTitle = "SpaceScooter!"; /** * Whether or not anti aliasing will be used for shapes. */ - public static boolean keyAntialiasing = false; + public static final boolean keyAntialiasing = false; /** * Whether or not to apply anti aliasing on text. */ - public static boolean textAntialiasing = false; + public static final boolean textAntialiasing = false; /** * The maximum number of points a player can reach. */ - public static int maximumPlayerScore = 99999999; + public static final int maximumPlayerScore = 99999999; /** * Initial health points the player will have. */ - public static int initialPlayerHealthPoints = 100; + public static final int initialPlayerHealthPoints = 100; /** * Initial shield points the player ship will have. */ - public static int initialPlayerShieldPoints = 0; + public static final int initialPlayerShieldPoints = 0; /** * Damage the player ships shots will cause initially. */ - public static int initialPlayerShotDamage = 10; + public static final int initialPlayerShotDamage = 10; /** * Private constructor, this class will never be instantiated. diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java index be39019..1e9d702 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java @@ -1,5 +1,6 @@ package de.teamteamteam.spacescooter.entity.enemy; +import de.teamteamteam.spacescooter.brain.GameConfig; import de.teamteamteam.spacescooter.entity.explosion.MultiExplosion; import de.teamteamteam.spacescooter.gui.BossHealthBar; import de.teamteamteam.spacescooter.utility.Random; @@ -42,7 +43,7 @@ public class EnemyBoss extends Enemy{ @Override public void update() { super.update(); - this.setPosition(750, this.getY()+move); + this.setPosition(GameConfig.windowWidth-65, this.getY()+move); if(this.getY() == 51){ move = 1; } diff --git a/src/de/teamteamteam/spacescooter/level/Level.java b/src/de/teamteamteam/spacescooter/level/Level.java index a0ab0f5..cb70067 100644 --- a/src/de/teamteamteam/spacescooter/level/Level.java +++ b/src/de/teamteamteam/spacescooter/level/Level.java @@ -52,26 +52,6 @@ public final class Level { */ private int gameOverDelay; - /** - * Offset for game screen 0 coordinate on X axis. - */ - private int gameScreenXOffset; - - /** - * Offset for game screen 0 coordinate on Y axis. - */ - private int gameScreenYOffset; - - /** - * Actual width of game screen. - */ - private int gameScreenWidth; - - /** - * Actual height of game screen. - */ - private int gameScreenHeight; - /** * Constructor creating a LevelConfig based on a given config file. */ @@ -80,12 +60,6 @@ public final class Level { this.isGameOver = false; this.gameOverDelay = 3; this.config = Loader.getLevelConfigByFilename(levelConfig); - - //TODO: Put this into the GameConfig! - this.gameScreenXOffset = 0; - this.gameScreenYOffset = 50; - this.gameScreenWidth = GameConfig.windowWidth - 1; //This is fine. - this.gameScreenHeight = GameConfig.windowHeight - 51; //TODO: NOT HARDCODE THIS :/ } @@ -131,8 +105,10 @@ public final class Level { if(relativeTimeWithinCurrentInterval % Math.max(1,intervalModulus) == 0) { //If the rule matches the current time, spawn the configured Entity in the configured amount: for(int i=0; i