Browse Source

inline commenting, bug fixing

Hudriwudri 4 years ago
parent
commit
a521c04abe

+ 52 - 5
src/pathgame/gameplay/Camera.java

@@ -1,8 +1,12 @@
 package pathgame.gameplay;
 package pathgame.gameplay;
 
 
+/**
+ * A container for all camera specific functions
+ *
+ * @author julia
+ */
 public class Camera
 public class Camera
 {
 {
-
     private final static int CAM_SPEED = 64;
     private final static int CAM_SPEED = 64;
 
 
     private float lastScale = 1.0f;
     private float lastScale = 1.0f;
@@ -13,6 +17,12 @@ public class Camera
     private float camOffsetX = 0.0f;
     private float camOffsetX = 0.0f;
     private float camOffsetY = 0.0f;
     private float camOffsetY = 0.0f;
 
 
+    /**
+     * Recalculates the camera position every gametick based on user input
+     *
+     * @param level a level containing the current map and the current player
+     * @param gamestate the gamestate
+     */
     public void tick(Level level, Gamestate gamestate)
     public void tick(Level level, Gamestate gamestate)
     {
     {
         lastCamOffsetX = camOffsetX;
         lastCamOffsetX = camOffsetX;
@@ -29,7 +39,7 @@ public class Camera
             {
             {
                 scale /= 1.1f;
                 scale /= 1.1f;
             }
             }
-            
+
             if(Keys.CAM_UP_KEY.isDown())
             if(Keys.CAM_UP_KEY.isDown())
             {
             {
                 camOffsetY += CAM_SPEED;
                 camOffsetY += CAM_SPEED;
@@ -49,6 +59,13 @@ public class Camera
         }
         }
     }
     }
 
 
+    /**
+     * Limits scale of camera
+     *
+     * @param zoomRestriction the lower zoom factor restriction (zooming out
+     * restriction)
+     * @return a tile texture constructed from a given texture id
+     */
     public void limitScale(float zoomRestriction)
     public void limitScale(float zoomRestriction)
     {
     {
         if(scale <= zoomRestriction)
         if(scale <= zoomRestriction)
@@ -61,7 +78,11 @@ public class Camera
         }
         }
 
 
     }
     }
-    
+
+    /**
+     * Resetting the camera to focus the player
+     *
+     */
     public void reset()
     public void reset()
     {
     {
         camOffsetX = 0.0f;
         camOffsetX = 0.0f;
@@ -70,11 +91,27 @@ public class Camera
         lastCamOffsetY = 0.0f;
         lastCamOffsetY = 0.0f;
     }
     }
 
 
+    /**
+     * Returns the interpolated scale
+     *
+     * @param lag the render lag
+     * @return the interpolated scale
+     */
     public float getInterpolatedScale(float lag)
     public float getInterpolatedScale(float lag)
     {
     {
         return lastScale + (scale - lastScale) * lag;
         return lastScale + (scale - lastScale) * lag;
     }
     }
-    
+
+    /**
+     * Returns the x-offset of the camera to the player
+     *
+     * @param offX the x-offset of the map
+     * @param minOffX the minimum x-offset restriction of the camera to prevent
+     * going outside the screen
+     * @param lag the render lag
+     * @param interScale the interpolated scale
+     * @return the x-offset of the camera to the player
+     */
     public float getCamOffsetX(float offX, float minOffX, float lag, float interScale)
     public float getCamOffsetX(float offX, float minOffX, float lag, float interScale)
     {
     {
         float interCamX = lastCamOffsetX + (camOffsetX - lastCamOffsetX) * lag;
         float interCamX = lastCamOffsetX + (camOffsetX - lastCamOffsetX) * lag;
@@ -98,7 +135,17 @@ public class Camera
         }
         }
         return offX + interCamX;
         return offX + interCamX;
     }
     }
-    
+
+    /**
+     * Returns the y-offset of the camera to the player
+     *
+     * @param offY the y-offset of the map
+     * @param minOffY the minimum y-offset restriction of the camera to prevent
+     * going outside the screen
+     * @param lag the render lag
+     * @param interScale the interpolated scale
+     * @return the y-offset of the camera to the player
+     */
     public float getCamOffsetY(float offY, float minOffY, float lag, float interScale)
     public float getCamOffsetY(float offY, float minOffY, float lag, float interScale)
     {
     {
         float interCamY = lastCamOffsetY + (camOffsetY - lastCamOffsetY) * lag;
         float interCamY = lastCamOffsetY + (camOffsetY - lastCamOffsetY) * lag;

+ 23 - 1
src/pathgame/gameplay/Gamestate.java

@@ -1,19 +1,41 @@
 package pathgame.gameplay;
 package pathgame.gameplay;
 
 
+/**
+ * A container for the gamestate
+ *
+ * @author julia
+ */
 public class Gamestate
 public class Gamestate
 {
 {
     private Gamestates state = Gamestates.MENU;
     private Gamestates state = Gamestates.MENU;
 
 
+    /**
+     * Sets the current gamestate
+     *
+     * @param state the desired gamestate
+     */
     public void setState(Gamestates state)
     public void setState(Gamestates state)
     {
     {
         this.state = state;
         this.state = state;
     }
     }
 
 
+    /**
+     * Returns the current gamestate
+     *
+     * @return the current game state
+     */
     public Gamestates getState()
     public Gamestates getState()
     {
     {
         return state;
         return state;
     }
     }
-    
+
+    /**
+     * Returns if current gamestate is same as gamestate from parameter
+     *
+     * @param gamestate the gamestate that has to be checked if it is the
+     * current
+     * @return if current gamestate is same as gamestate from parameter
+     */
     public boolean is(Gamestates gamestate)
     public boolean is(Gamestates gamestate)
     {
     {
         return state == gamestate;
         return state == gamestate;

+ 15 - 5
src/pathgame/gameplay/Keys.java

@@ -8,9 +8,13 @@ import me.hammerle.snuviengine.api.KeyBinding;
 import me.hammerle.snuviengine.api.KeyHandler;
 import me.hammerle.snuviengine.api.KeyHandler;
 import org.lwjgl.glfw.GLFW;
 import org.lwjgl.glfw.GLFW;
 
 
+/**
+ * A container for all keys
+ *
+ * @author julia
+ */
 public class Keys
 public class Keys
 {
 {
-
     public static final KeyBinding UP_KEY = KeyHandler.register(GLFW.GLFW_KEY_W);
     public static final KeyBinding UP_KEY = KeyHandler.register(GLFW.GLFW_KEY_W);
     public static final KeyBinding DOWN_KEY = KeyHandler.register(GLFW.GLFW_KEY_S);
     public static final KeyBinding DOWN_KEY = KeyHandler.register(GLFW.GLFW_KEY_S);
     public static final KeyBinding LEFT_KEY = KeyHandler.register(GLFW.GLFW_KEY_A);
     public static final KeyBinding LEFT_KEY = KeyHandler.register(GLFW.GLFW_KEY_A);
@@ -27,18 +31,24 @@ public class Keys
     public static final KeyBinding OVERLAY_KEY = KeyHandler.register(GLFW.GLFW_KEY_TAB);
     public static final KeyBinding OVERLAY_KEY = KeyHandler.register(GLFW.GLFW_KEY_TAB);
     public static final KeyBinding BOAT_KEY = KeyHandler.register(GLFW.GLFW_KEY_E);
     public static final KeyBinding BOAT_KEY = KeyHandler.register(GLFW.GLFW_KEY_E);
 
 
+    /**
+     * An array of all rebindable keys
+     */
     public static final KeyBinding[] KEYS = new KeyBinding[]
     public static final KeyBinding[] KEYS = new KeyBinding[]
     {
     {
-        UP_KEY, DOWN_KEY, LEFT_KEY, RIGHT_KEY, ZOOM_IN_KEY, ZOOM_OUT_KEY, 
-        CAM_UP_KEY, CAM_DOWN_KEY, CAM_LEFT_KEY, 
+        UP_KEY, DOWN_KEY, LEFT_KEY, RIGHT_KEY, ZOOM_IN_KEY, ZOOM_OUT_KEY,
+        CAM_UP_KEY, CAM_DOWN_KEY, CAM_LEFT_KEY,
         CAM_RIGHT_KEY, OVERLAY_KEY, BOAT_KEY
         CAM_RIGHT_KEY, OVERLAY_KEY, BOAT_KEY
     };
     };
-    
+
+    /**
+     * An array of the names of all rebindable keys
+     */
     public static final String[] KEYNAMES =
     public static final String[] KEYNAMES =
     {
     {
         "Up Key", "Down Key", "Left Key", "Right Key", "Zoom In Key",
         "Up Key", "Down Key", "Left Key", "Right Key", "Zoom In Key",
         "Zoom Out Key", "Cam Up Key", "Cam Down Key", "Cam Left Key",
         "Zoom Out Key", "Cam Up Key", "Cam Down Key", "Cam Left Key",
-         "Cam Right Key", "Overlay Key", "Boat Key"
+        "Cam Right Key", "Overlay Key", "Boat Key"
     };
     };
 
 
     static
     static

+ 58 - 7
src/pathgame/gameplay/Level.java

@@ -5,6 +5,11 @@ import pathgame.logging.Logger;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileMapGenerator;
 import pathgame.tilemap.TileMapGenerator;
 
 
+/**
+ * A level of the game containing the current map and the current player
+ *
+ * @author julia
+ */
 public final class Level
 public final class Level
 {
 {
     private final Player player = new Player();
     private final Player player = new Player();
@@ -13,11 +18,20 @@ public final class Level
     private boolean showScoreMenu = false;
     private boolean showScoreMenu = false;
     private boolean showAfterScore = false;
     private boolean showAfterScore = false;
 
 
+    /**
+     * Contructor generating and initializing new Level and Player
+     */
     public Level()
     public Level()
     {
     {
         reset();
         reset();
     }
     }
 
 
+    /**
+     * Checks gamestate changes every gametick based on user input and game
+     * events
+     *
+     * @param gamestate the gamestate
+     */
     public void tick(Gamestate gamestate)
     public void tick(Gamestate gamestate)
     {
     {
         map.tick();
         map.tick();
@@ -36,55 +50,92 @@ public final class Level
         }
         }
     }
     }
 
 
+    /**
+     * Loads the next level
+     */
     public void nextLevel()
     public void nextLevel()
     {
     {
         level++;
         level++;
         reset();
         reset();
     }
     }
 
 
+    /**
+     * Resets the current level
+     */
     public void reset()
     public void reset()
     {
     {
         int levelW = Math.round(16.0f + (level * 16.0f / 9.0f));
         int levelW = Math.round(16.0f + (level * 16.0f / 9.0f));
         int levelH = Math.round(9.0f + (level * 16.0f / 16.0f));
         int levelH = Math.round(9.0f + (level * 16.0f / 16.0f));
         int towns = Math.round(2.0f + level * 0.5f);
         int towns = Math.round(2.0f + level * 0.5f);
-        
+
         map = TileMapGenerator.getMap(levelW, levelH, level, towns);
         map = TileMapGenerator.getMap(levelW, levelH, level, towns);
         player.reset(map.getHomeX(), map.getHomeY());
         player.reset(map.getHomeX(), map.getHomeY());
         player.setObjectivesAmount(map.getNumberOfTowns());
         player.setObjectivesAmount(map.getNumberOfTowns());
-        
+
         int algoEnergy = TravellingSalesAlg.calcSalesPathLen(map, player);
         int algoEnergy = TravellingSalesAlg.calcSalesPathLen(map, player);
-        
+
         player.setEnergySupply(algoEnergy);
         player.setEnergySupply(algoEnergy);
-        
+
         Logger.onLevelReset(level, player, map);
         Logger.onLevelReset(level, player, map);
     }
     }
 
 
+    /**
+     * Returns the map of the current level
+     *
+     * @return the map of the current level
+     */
     public TileMap getMap()
     public TileMap getMap()
     {
     {
         return map;
         return map;
     }
     }
 
 
+    /**
+     * Returns the player of the current level
+     *
+     * @return the player of the current level
+     */
     public Player getPlayer()
     public Player getPlayer()
     {
     {
         return player;
         return player;
     }
     }
 
 
+    /**
+     * Returns the current level
+     *
+     * @return the current level
+     */
     public int getLevel()
     public int getLevel()
     {
     {
         return level;
         return level;
     }
     }
-    
+
+    /**
+     * Returns if the AfterScoreMenu is showed
+     *
+     * @return if the AfterScoreMenu is showed
+     */
     public boolean isShowingAfterScore()
     public boolean isShowingAfterScore()
     {
     {
         return showAfterScore;
         return showAfterScore;
     }
     }
-    
+
+    /**
+     * Sets if the AfterScoreMenu should be showed
+     *
+     * @param show sets if the AfterScore should be showed
+     */
     public void setShowAfterScore(boolean show)
     public void setShowAfterScore(boolean show)
     {
     {
         showAfterScore = show;
         showAfterScore = show;
     }
     }
+
+    /**
+     * Returns if the ScoreMenu is showed
+     *
+     * @return if the ScoreMenu is showed
+     */
     public boolean isShowingScoreMenu()
     public boolean isShowingScoreMenu()
     {
     {
-        return showScoreMenu; 
+        return showScoreMenu;
     }
     }
 }
 }

+ 28 - 1
src/pathgame/gameplay/MinusStepsValues.java

@@ -1,28 +1,55 @@
 package pathgame.gameplay;
 package pathgame.gameplay;
 
 
+/**
+ * A container for holding an energy cost from the step of the player with a
+ * lifetime for showing in the HUD
+ *
+ * @author julia
+ */
 public class MinusStepsValues
 public class MinusStepsValues
 {
 {
     private final int minusValue;
     private final int minusValue;
     private int lifeTime = 0;
     private int lifeTime = 0;
 
 
+    /**
+     * Contructor initializing a new energyCost with a lifetime
+     *
+     * @param minusValue energyCost of a step of the player
+     */
     public MinusStepsValues(int minusValue)
     public MinusStepsValues(int minusValue)
     {
     {
         this.minusValue = minusValue;
         this.minusValue = minusValue;
     }
     }
 
 
+    /**
+     * Returns the energyCost value
+     *
+     * @return energyCost value
+     */
     public int getValue()
     public int getValue()
     {
     {
         return minusValue;
         return minusValue;
     }
     }
 
 
+    /**
+     * Returns the energyCost lifetime
+     *
+     * @return energyCost lifetime
+     */
     public int getLifeTime()
     public int getLifeTime()
     {
     {
         return lifeTime;
         return lifeTime;
     }
     }
 
 
+    /**
+     * Recalculates the lifetime every gametick and returns if energyCost is
+     * still alive
+     *
+     * @return if energyCost is still alive
+     */
     public boolean tick()
     public boolean tick()
     {
     {
         lifeTime++;
         lifeTime++;
         return lifeTime >= 10;
         return lifeTime >= 10;
     }
     }
-}
+}

+ 154 - 3
src/pathgame/gameplay/Player.java

@@ -6,9 +6,13 @@ import pathgame.logging.Logger;
 import pathgame.tilemap.Tile;
 import pathgame.tilemap.Tile;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileMap;
 
 
+/**
+ * A container for holding everything about the player
+ *
+ * @author julia
+ */
 public class Player
 public class Player
 {
 {
-
     private static final float SPEED = 0.25f;
     private static final float SPEED = 0.25f;
 
 
     private PlayerAbilities abilities = PlayerAbilities.NORMAL;
     private PlayerAbilities abilities = PlayerAbilities.NORMAL;
@@ -32,25 +36,49 @@ public class Player
     private final LinkedList<MinusStepsValues> steps = new LinkedList<>();
     private final LinkedList<MinusStepsValues> steps = new LinkedList<>();
     private Tile currentTile;// = Tiles.GRASS;
     private Tile currentTile;// = Tiles.GRASS;
 
 
+    /**
+     * Constructor of the player
+     *
+     */
     public Player()
     public Player()
     {
     {
     }
     }
 
 
+    /**
+     * Returns x-position of the player of the last frame
+     *
+     * @return x-position of the player of the last frame
+     */
     public float getLastX()
     public float getLastX()
     {
     {
         return lastX;
         return lastX;
     }
     }
 
 
+    /**
+     * Returns y-position of the player of the last frame
+     *
+     * @return y-position of the player of the last frame
+     */
     public float getLastY()
     public float getLastY()
     {
     {
         return lastY;
         return lastY;
     }
     }
 
 
+    /**
+     * Returns current x-position of the player
+     *
+     * @return current x-position of the player
+     */
     public float getX()
     public float getX()
     {
     {
         return x;
         return x;
     }
     }
 
 
+    /**
+     * Returns current y-position of the player
+     *
+     * @return current y-position of the player
+     */
     public float getY()
     public float getY()
     {
     {
         return y;
         return y;
@@ -69,6 +97,11 @@ public class Player
         }
         }
     }
     }
 
 
+    /**
+     * Recalculates the player position every gametick based on user input
+     *
+     * @param map the current map
+     */
     public void tick(TileMap map)
     public void tick(TileMap map)
     {
     {
         tickSteps();
         tickSteps();
@@ -172,92 +205,185 @@ public class Player
         return Math.abs(x - Math.round(x)) < 0.01f && Math.abs(y - Math.round(y)) < 0.01f;
         return Math.abs(x - Math.round(x)) < 0.01f && Math.abs(y - Math.round(y)) < 0.01f;
     }
     }
 
 
+    /**
+     * Returns the current x-velocity of the player
+     *
+     * @return the current x-velocity of the player
+     */
     public float getVelX()
     public float getVelX()
     {
     {
         return velX;
         return velX;
     }
     }
 
 
+    /**
+     * Returns the current y-velocity of the player
+     *
+     * @return the current y-velocity of the player
+     */
     public float getVelY()
     public float getVelY()
     {
     {
         return velY;
         return velY;
     }
     }
 
 
+    /**
+     * Returns the overall energy supply of the player for the current map
+     *
+     * @return the overall energy supply of the player for the current map
+     */
     public int getEnergySupply()
     public int getEnergySupply()
     {
     {
         return energySupply;
         return energySupply;
     }
     }
 
 
+    /**
+     * Returns the current energy of the player that is left for the current map
+     *
+     * @return the current energy of the player that is left for the current map
+     */
     public int getEnergyLeft()
     public int getEnergyLeft()
     {
     {
         return energySupply - energyUsed;
         return energySupply - energyUsed;
     }
     }
 
 
+    /**
+     * Returns the energy of the player that is already used for the current map
+     *
+     * @return the energy of the player that is already used for the current map
+     */
     public int getEnergyUsed()
     public int getEnergyUsed()
     {
     {
         return energyUsed;
         return energyUsed;
     }
     }
 
 
+    /**
+     * Returns the overall amount of objectives that the player has to visit
+     *
+     * @return the overall amount of objectives that the player has to visit
+     */
     public int getObjectivesAmount()
     public int getObjectivesAmount()
     {
     {
         return objectivesAmount;
         return objectivesAmount;
     }
     }
 
 
+    /**
+     * Sets the overall amount of objectives that the player has to visit
+     *
+     * @param objectivesAmount sets the overall amount of objectives that the
+     * player has to visit
+     */
     public void setObjectivesAmount(int objectivesAmount)
     public void setObjectivesAmount(int objectivesAmount)
     {
     {
         this.objectivesAmount = objectivesAmount;
         this.objectivesAmount = objectivesAmount;
     }
     }
 
 
+    /**
+     * Returns the amount of objectives that the player has already to visited
+     *
+     * @return the amount of objectives that the player has already to visited
+     */
     public int getObjectivesVisited()
     public int getObjectivesVisited()
     {
     {
         return objectivesVisited;
         return objectivesVisited;
     }
     }
 
 
+    /**
+     * Player visits a town and updates the player statistics
+     */
     public void visitTown()
     public void visitTown()
     {
     {
         objectivesVisited++;
         objectivesVisited++;
     }
     }
 
 
+    /**
+     * Returns a list of the last energy costs of the last steps of the player
+     *
+     * @return a list of the last energy costs of the last steps of the player
+     */
     public LinkedList<MinusStepsValues> getLastSteps()
     public LinkedList<MinusStepsValues> getLastSteps()
     {
     {
         return steps;
         return steps;
     }
     }
 
 
+    /**
+     * Sets the abilities of the player
+     *
+     * @param playerAbilities sets the abilities of the player
+     */
     public void setAbilities(PlayerAbilities playerAbilities)
     public void setAbilities(PlayerAbilities playerAbilities)
     {
     {
         abilities = playerAbilities;
         abilities = playerAbilities;
     }
     }
 
 
+    /**
+     * Returns the abilities of the player
+     *
+     * @return the abilities of the player
+     */
     public PlayerAbilities getAbilities()
     public PlayerAbilities getAbilities()
     {
     {
         return abilities;
         return abilities;
     }
     }
 
 
+    /**
+     * Sets the overall energy supply for the player for the current map
+     *
+     * @param energySupply sets the overall energy supply for the player for the
+     * current map
+     */
     public void setEnergySupply(int energySupply)
     public void setEnergySupply(int energySupply)
     {
     {
         this.energySupply = energySupply;
         this.energySupply = energySupply;
     }
     }
 
 
+    /**
+     * Returns if player has already visited all towns and is allowed win when
+     * going to the start field
+     *
+     * @return if player has already visited all towns and is allowed win when
+     * going to the start field
+     */
     public boolean canWin()
     public boolean canWin()
     {
     {
         return objectivesVisited >= objectivesAmount;
         return objectivesVisited >= objectivesAmount;
     }
     }
-    
+
+    /**
+     * Returns if player has already won the current map
+     *
+     * @return if player has already won the current map
+     */
     public boolean hasWon()
     public boolean hasWon()
     {
     {
         return hasWon;
         return hasWon;
     }
     }
 
 
+    /**
+     * Player wins and updates the player statistics
+     */
     public void win(TileMap map)
     public void win(TileMap map)
     {
     {
         this.hasWon = true;
         this.hasWon = true;
         Logger.onWin(this, map);
         Logger.onWin(this, map);
     }
     }
 
 
+    /**
+     * Returns if player has lost the current map
+     *
+     * @return if player has lost the current map
+     */
     public boolean hasLost()
     public boolean hasLost()
     {
     {
         return energyUsed >= energySupply;
         return energyUsed >= energySupply;
     }
     }
 
 
+    /**
+     * Player is resetted
+     *
+     * @param sx start x-position
+     * @param sy start y-position
+     * @param energySupply overall energy supply for current map
+     * @param objectivesAmount objectives amount on current map
+     */
     public void reset(int sx, int sy, int energySupply, int objectivesAmount)
     public void reset(int sx, int sy, int energySupply, int objectivesAmount)
     {
     {
         lastX = sx;
         lastX = sx;
@@ -280,26 +406,51 @@ public class Player
         this.objectivesAmount = objectivesAmount;
         this.objectivesAmount = objectivesAmount;
     }
     }
 
 
+    /**
+     * Player is resetted, energy supply is set to standard of 1000, objectives
+     * amount is set to standard of 10
+     *
+     * @param sx start x-position
+     * @param sy start y-position
+     */
     public void reset(int sx, int sy)
     public void reset(int sx, int sy)
     {
     {
         reset(sx, sy, 1000, 10);
         reset(sx, sy, 1000, 10);
     }
     }
 
 
+    /**
+     * Returns if player is currently moving
+     *
+     * @return if player is currently moving
+     */
     public boolean isMoving()
     public boolean isMoving()
     {
     {
         return isMoving;
         return isMoving;
     }
     }
 
 
+    /**
+     * Changes Player state to sailing
+     */
     public void switchSailing()
     public void switchSailing()
     {
     {
         isSailing = !isSailing;
         isSailing = !isSailing;
     }
     }
-    
+
+    /**
+     * Returns if player is currently sailing
+     *
+     * @return if player is currently sailing
+     */
     public boolean isSailing()
     public boolean isSailing()
     {
     {
         return isSailing;
         return isSailing;
     }
     }
 
 
+    /**
+     * Returns the tile the player is currently standing on
+     *
+     * @return the tile the player is currently standing on
+     */
     public Tile getCurrTile()
     public Tile getCurrTile()
     {
     {
         return currentTile;
         return currentTile;

+ 71 - 5
src/pathgame/gameplay/PlayerAbilities.java

@@ -1,5 +1,10 @@
 package pathgame.gameplay;
 package pathgame.gameplay;
 
 
+/**
+ * A container for holding all player abilities
+ *
+ * @author julia
+ */
 public class PlayerAbilities
 public class PlayerAbilities
 {
 {
     private final String name;
     private final String name;
@@ -10,8 +15,27 @@ public class PlayerAbilities
     private final int fasterHill;
     private final int fasterHill;
     private final int fasterMountain;
     private final int fasterMountain;
     private final int fasterSwamp;
     private final int fasterSwamp;
-    
-    public PlayerAbilities(String name, int fasterGrass, int fasterForest, int fasterShallowWater, 
+
+    /**
+     * Contructor initializing new player abilities
+     *
+     * @param name name of the character type with this specific abilities
+     * @param fasterGrass the energyCostsPoints the player can move faster on
+     * grass tiles
+     * @param fasterForest the energyCostsPoints the player can move faster on
+     * forest tiles
+     * @param fasterShallowWater the energyCostsPoints the player can move
+     * faster on shallow water tiles
+     * @param fasterDeepWater the energyCostsPoints the player can move faster
+     * on deep water tiles
+     * @param fasterHill the energyCostsPoints the player can move faster on
+     * hill tiles
+     * @param fasterMountain the energyCostsPoints the player can move faster on
+     * mountain tiles
+     * @param fasterSwamp the energyCostsPoints the player can move faster on
+     * swamp tiles
+     */
+    public PlayerAbilities(String name, int fasterGrass, int fasterForest, int fasterShallowWater,
             int fasterDeepWater, int fasterHill, int fasterMountain, int fasterSwamp)
             int fasterDeepWater, int fasterHill, int fasterMountain, int fasterSwamp)
     {
     {
         this.name = name;
         this.name = name;
@@ -29,49 +53,91 @@ public class PlayerAbilities
     public final static PlayerAbilities HUNTER = new PlayerAbilities("Hunter", 0, 1, 0, 0, 0, 0, 1);
     public final static PlayerAbilities HUNTER = new PlayerAbilities("Hunter", 0, 1, 0, 0, 0, 0, 1);
     public final static PlayerAbilities SWIMMER = new PlayerAbilities("Swimmer", 0, 0, 3, 0, 0, 0, 0);
     public final static PlayerAbilities SWIMMER = new PlayerAbilities("Swimmer", 0, 0, 3, 0, 0, 0, 0);
     public final static PlayerAbilities SAILOR = new PlayerAbilities("Sailor", 0, 0, 0, 1, 0, 0, 0);
     public final static PlayerAbilities SAILOR = new PlayerAbilities("Sailor", 0, 0, 0, 1, 0, 0, 0);
-    
-    public final static PlayerAbilities[] ABILITIES = new PlayerAbilities[] 
+    /**
+     * Array of all character types
+     */
+    public final static PlayerAbilities[] ABILITIES = new PlayerAbilities[]
     {
     {
         NORMAL, HIKER, HUNTER, SWIMMER, SAILOR
         NORMAL, HIKER, HUNTER, SWIMMER, SAILOR
     };
     };
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on grass tiles
+     *
+     * @return the energyCostPoints the player is faster on grass tiles
+     */
     public int getFasterGrass()
     public int getFasterGrass()
     {
     {
         return fasterGrass;
         return fasterGrass;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on forest tiles
+     *
+     * @return the energyCostPoints the player is faster on forest tiles
+     */
     public int getFasterForest()
     public int getFasterForest()
     {
     {
         return fasterForest;
         return fasterForest;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on shallow water tiles
+     *
+     * @return the energyCostPoints the player is faster on shallow water tiles
+     */
     public int getFasterShallowWater()
     public int getFasterShallowWater()
     {
     {
         return fasterShallowWater;
         return fasterShallowWater;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on deep water tiles
+     *
+     * @return the energyCostPoints the player is faster on deep water tiles
+     */
     public int getFasterDeepWater()
     public int getFasterDeepWater()
     {
     {
         return fasterDeepWater;
         return fasterDeepWater;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on hill tiles
+     *
+     * @return the energyCostPoints the player is faster on hill tiles
+     */
     public int getFasterHill()
     public int getFasterHill()
     {
     {
         return fasterHill;
         return fasterHill;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on mountain tiles
+     *
+     * @return the energyCostPoints the player is faster on mountain tiles
+     */
     public int getFasterMountain()
     public int getFasterMountain()
     {
     {
         return fasterMountain;
         return fasterMountain;
     }
     }
 
 
+    /**
+     * Returns the energyCostPoints the player is faster on swamp tiles
+     *
+     * @return the energyCostPoints the player is faster on swamp tiles
+     */
     public int getFasterSwamp()
     public int getFasterSwamp()
     {
     {
         return fasterSwamp;
         return fasterSwamp;
     }
     }
 
 
+    /**
+     * Returns the name of the current character type
+     *
+     * @return the name of the current character type
+     */
     public String getName()
     public String getName()
     {
     {
         return name;
         return name;
     }
     }
-}
+}

+ 16 - 1
src/pathgame/gameplay/menu/AfterScoreMenu.java

@@ -2,11 +2,21 @@ package pathgame.gameplay.menu;
 
 
 import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.Gamestates;
 
 
+/**
+ * A container for holding all options of the AfterScoreMenu
+ *
+ * @author julia
+ */
 public class AfterScoreMenu extends BaseMenu
 public class AfterScoreMenu extends BaseMenu
 {
 {
-
     private final MenuButton[] options;
     private final MenuButton[] options;
 
 
+    /**
+     * Contructor generating and initializing the AfterScoreMenu
+     * 
+     * @param id the id of the AfterScoreMenu
+     * @param mainId the id to the MainMenu
+     */
     public AfterScoreMenu(int id, int mainId)
     public AfterScoreMenu(int id, int mainId)
     {
     {
         super(id);
         super(id);
@@ -35,6 +45,11 @@ public class AfterScoreMenu extends BaseMenu
         };
         };
     }
     }
 
 
+    /**
+     * Returns the options of the AfterScoreMenu
+     *
+     * @return the options of the AfterScoreMenu
+     */
     @Override
     @Override
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {

+ 55 - 10
src/pathgame/gameplay/menu/BaseMenu.java

@@ -5,28 +5,58 @@ import pathgame.gameplay.Gamestate;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Level;
 import pathgame.gameplay.Level;
 
 
+/**
+ * Base class of the menus
+ *
+ * @author julia
+ */
 public abstract class BaseMenu
 public abstract class BaseMenu
 {
 {
     private final int id;
     private final int id;
     private int index = 0;
     private int index = 0;
+
     public abstract MenuButton[] getOptions();
     public abstract MenuButton[] getOptions();
     private int returnId;
     private int returnId;
-    
+
+    /**
+     * Contructor generating and initializing the menu
+     *
+     * @param id the id of the desired menu
+     */
     public BaseMenu(int id)
     public BaseMenu(int id)
     {
     {
         this.id = id;
         this.id = id;
     }
     }
-    
+
+    /**
+     * Returns the index of the active menu button
+     *
+     * @return the index of the active menu button
+     */
     public int getActiveIndex()
     public int getActiveIndex()
     {
     {
         return index;
         return index;
     }
     }
-    
+
+    /**
+     * Returns if this is the OptionMenu
+     *
+     * @return if this is the OptionMenu
+     */
     public boolean isOptionMenu()
     public boolean isOptionMenu()
     {
     {
         return false;
         return false;
     }
     }
-    
+
+    /**
+     * Updates the menu state every gametick based on user input and returns the
+     * id of the current menu
+     *
+     * @param gamestate the gamestate
+     * @param level a level containing the current map and the current player
+     *
+     * @return the id of the current menu
+     */
     public int tick(Gamestate gamestate, Level level)
     public int tick(Gamestate gamestate, Level level)
     {
     {
         returnId = id;
         returnId = id;
@@ -49,21 +79,36 @@ public abstract class BaseMenu
         }
         }
         return returnId;
         return returnId;
     }
     }
-    
+
+    /**
+     * Sets the id of the current menu
+     *
+     * @param id the id of the current menu
+     *
+     */
     public void setReturnId(int id)
     public void setReturnId(int id)
     {
     {
         returnId = id;
         returnId = id;
     }
     }
-            
+
+    /**
+     * Resets the index of the current button to the first button
+     *
+     */
     public void resetIndex()
     public void resetIndex()
     {
     {
         index = 0;
         index = 0;
     }
     }
-    
+
+    /**
+     * Returns if the key of the parameter is pressed
+     *
+     * @param key the key that is checked
+     * @return if the key is pressed
+     */
     private boolean isKeyPressed(KeyBinding key)
     private boolean isKeyPressed(KeyBinding key)
     {
     {
         return key.getTime() == 1 || (key.getTime() >= 20 && key.getTime() % 5 == 1);
         return key.getTime() == 1 || (key.getTime() >= 20 && key.getTime() % 5 == 1);
     }
     }
-    
-    
-}
+
+}

+ 16 - 1
src/pathgame/gameplay/menu/CharacterMenu.java

@@ -3,11 +3,21 @@ package pathgame.gameplay.menu;
 import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.PlayerAbilities;
 import pathgame.gameplay.PlayerAbilities;
 
 
+/**
+ * A container for holding all options of the CharacterMenu
+ *
+ * @author julia
+ */
 public class CharacterMenu extends BaseMenu
 public class CharacterMenu extends BaseMenu
 {
 {
-
     private final MenuButton[] options;
     private final MenuButton[] options;
 
 
+    /**
+     * Contructor generating and initializing the CharacterMenu
+     * 
+     * @param id the id of the CharacterMenu
+     * @param mainId the id to the MainMenu
+     */
     public CharacterMenu(int id, int mainId)
     public CharacterMenu(int id, int mainId)
     {
     {
         super(id);
         super(id);
@@ -32,6 +42,11 @@ public class CharacterMenu extends BaseMenu
         });
         });
     }
     }
 
 
+    /**
+     * Returns the options of the CharacterMenu
+     *
+     * @return the options of the CharacterMenu
+     */
     @Override
     @Override
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {

+ 22 - 6
src/pathgame/gameplay/menu/EscMenu.java

@@ -3,31 +3,47 @@ package pathgame.gameplay.menu;
 import me.hammerle.snuviengine.api.Engine;
 import me.hammerle.snuviengine.api.Engine;
 import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.Gamestates;
 
 
+/**
+ * A container for holding all options of the EscapeMenu
+ *
+ * @author julia
+ */
 public class EscMenu extends BaseMenu
 public class EscMenu extends BaseMenu
 {
 {
     private final MenuButton[] options;
     private final MenuButton[] options;
-    
+
+    /**
+     * Contructor generating and initializing the EscapeMenu
+     *
+     * @param id the id of the EscapeMenu
+     * @param mainId the id to the MainMenu
+     */
     public EscMenu(int id, int mainId)
     public EscMenu(int id, int mainId)
     {
     {
         super(id);
         super(id);
-        
-        options = new MenuButton[] 
+
+        options = new MenuButton[]
         {
         {
-            new MenuButton("Continue", (gamestate) -> 
+            new MenuButton("Continue", (gamestate) ->
             {
             {
                 gamestate.setState(Gamestates.GAMEPLAY);
                 gamestate.setState(Gamestates.GAMEPLAY);
             }),
             }),
-            new MenuButton("Main Menu", (gamestate) -> 
+            new MenuButton("Main Menu", (gamestate) ->
             {
             {
                 setReturnId(mainId);
                 setReturnId(mainId);
             }),
             }),
-            new MenuButton("Exit", (gamestate) -> 
+            new MenuButton("Exit", (gamestate) ->
             {
             {
                 Engine.stop();
                 Engine.stop();
             }),
             }),
         };
         };
     }
     }
 
 
+    /**
+     * Returns the options of the EscapeMenu
+     *
+     * @return the options of the EscapeMenu
+     */
     @Override
     @Override
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {

+ 26 - 9
src/pathgame/gameplay/menu/MainMenu.java

@@ -2,31 +2,48 @@ package pathgame.gameplay.menu;
 
 
 import me.hammerle.snuviengine.api.Engine;
 import me.hammerle.snuviengine.api.Engine;
 
 
+/**
+ * A container for holding all options of the MainMenu
+ *
+ * @author julia
+ */
 public class MainMenu extends BaseMenu
 public class MainMenu extends BaseMenu
 {
 {
     private final MenuButton[] options;
     private final MenuButton[] options;
-    
-    public MainMenu(int id, int optionsId, int charaterId)
+
+    /**
+     * Contructor generating and initializing the MainMenu
+     *
+     * @param id the id of the MainMenu
+     * @param optionsId the id to the OptionMenu
+     * @param characterId the id to the CharacterMenu
+     */
+    public MainMenu(int id, int optionsId, int characterId)
     {
     {
         super(id);
         super(id);
-        
-        options = new MenuButton[] 
+
+        options = new MenuButton[]
         {
         {
-            new MenuButton("Start", (gamestate) -> 
+            new MenuButton("Start", (gamestate) ->
             {
             {
-                setReturnId(charaterId);
+                setReturnId(characterId);
             }),
             }),
-            new MenuButton("Options", (gamestate) -> 
+            new MenuButton("Options", (gamestate) ->
             {
             {
                 setReturnId(optionsId);
                 setReturnId(optionsId);
             }),
             }),
-            new MenuButton("Exit", (gamestate) -> 
+            new MenuButton("Exit", (gamestate) ->
             {
             {
                 Engine.stop();
                 Engine.stop();
             })
             })
-        }; 
+        };
     }
     }
 
 
+    /**
+     * Returns the options of the MainMenu
+     *
+     * @return the options of the MainMenu
+     */
     @Override
     @Override
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {

+ 30 - 0
src/pathgame/gameplay/menu/Menu.java

@@ -5,6 +5,11 @@ import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Level;
 import pathgame.gameplay.Level;
 
 
+/**
+ * A container for holding and manages all kinds of menus
+ *
+ * @author julia
+ */
 public class Menu
 public class Menu
 {
 {
     private final static int MAIN_ID;
     private final static int MAIN_ID;
@@ -34,6 +39,12 @@ public class Menu
 
 
     private int currentIndex = 0;
     private int currentIndex = 0;
 
 
+    /**
+     * Updates the menu state every gametick based on user input
+     *
+     * @param gamestate the gamestate
+     * @param level a level containing the current map and the current player
+     */
     public void tick(Gamestate gamestate, Level level)
     public void tick(Gamestate gamestate, Level level)
     {
     {
         if(gamestate.getState() == Gamestates.MENU)
         if(gamestate.getState() == Gamestates.MENU)
@@ -63,21 +74,40 @@ public class Menu
         }
         }
     }
     }
 
 
+    /**
+     * Returns the array of menu buttons of the menu
+     *
+     * @return the array of menu buttons of the menu
+     */
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {
         return menus[currentIndex].getOptions();
         return menus[currentIndex].getOptions();
     }
     }
 
 
+    /**
+     * Returns the index of the active menu button
+     *
+     * @return the index of the active menu button
+     */
     public int getActiveIndex()
     public int getActiveIndex()
     {
     {
         return menus[currentIndex].getActiveIndex();
         return menus[currentIndex].getActiveIndex();
     }
     }
 
 
+    /**
+     * Returns if this is the OptionMenu
+     *
+     * @return if this is the OptionMenu
+     */
     public boolean isOptionMenu()
     public boolean isOptionMenu()
     {
     {
         return menus[currentIndex].isOptionMenu();
         return menus[currentIndex].isOptionMenu();
     }
     }
 
 
+    /**
+     * Opens the escape menu
+     *
+     */
     public void showEscapeMenu()
     public void showEscapeMenu()
     {
     {
         currentIndex = ESCAPE_ID;
         currentIndex = ESCAPE_ID;

+ 31 - 3
src/pathgame/gameplay/menu/MenuButton.java

@@ -5,27 +5,55 @@ import java.util.function.Consumer;
 import pathgame.gameplay.Gamestate;
 import pathgame.gameplay.Gamestate;
 import pathgame.gameplay.Level;
 import pathgame.gameplay.Level;
 
 
+/**
+ * A container for holding everything about a menu button
+ *
+ * @author julia
+ */
 public class MenuButton
 public class MenuButton
 {
 {
     private final String name;
     private final String name;
     private final BiConsumer<Gamestate, Level> r;
     private final BiConsumer<Gamestate, Level> r;
-    
+
+    /**
+     * Contructor initializing a menu button
+     *
+     * @param name the name of the button to be shown to the player
+     * @param r function that is executed when pressed on the button
+     */
     public MenuButton(String name, BiConsumer<Gamestate, Level> r)
     public MenuButton(String name, BiConsumer<Gamestate, Level> r)
     {
     {
         this.name = name;
         this.name = name;
         this.r = r;
         this.r = r;
     }
     }
-    
+
+    /**
+     * Contructor initializing a menu button
+     *
+     * @param name the name of the button to be shown to the player
+     * @param r function that is executed when pressed on the button
+     */
     public MenuButton(String name, Consumer<Gamestate> r)
     public MenuButton(String name, Consumer<Gamestate> r)
     {
     {
         this(name, (gamestate, level) -> r.accept(gamestate));
         this(name, (gamestate, level) -> r.accept(gamestate));
     }
     }
 
 
+    /**
+     * Returns the name of the button
+     *
+     * @return the name of the button
+     */
     public String getName()
     public String getName()
     {
     {
         return name;
         return name;
     }
     }
-    
+
+    /**
+     * runs the button function
+     *
+     * @param gamestate the gamestate
+     * @param level the current level
+     */
     public void run(Gamestate gamestate, Level level)
     public void run(Gamestate gamestate, Level level)
     {
     {
         r.accept(gamestate, level);
         r.accept(gamestate, level);

+ 21 - 1
src/pathgame/gameplay/menu/OptionMenu.java

@@ -8,11 +8,21 @@ import me.hammerle.snuviengine.api.KeyBinding;
 import me.hammerle.snuviengine.api.KeyHandler;
 import me.hammerle.snuviengine.api.KeyHandler;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Keys;
 
 
+/**
+ * A container for holding all options of the OptionMenu
+ *
+ * @author julia
+ */
 public class OptionMenu extends BaseMenu
 public class OptionMenu extends BaseMenu
 {
 {
-
     private final MenuButton[] options;
     private final MenuButton[] options;
 
 
+    /**
+     * Contructor generating and initializing the OptionMenu
+     *
+     * @param id the id of the OptionMenu
+     * @param mainId the id to the MainMenu
+     */
     public OptionMenu(int id, int mainId)
     public OptionMenu(int id, int mainId)
     {
     {
         super(id);
         super(id);
@@ -47,12 +57,22 @@ public class OptionMenu extends BaseMenu
         });
         });
     }
     }
 
 
+    /**
+     * Returns the options of the OptionMenu
+     *
+     * @return the options of the OptionMenu
+     */
     @Override
     @Override
     public MenuButton[] getOptions()
     public MenuButton[] getOptions()
     {
     {
         return options;
         return options;
     }
     }
 
 
+    /**
+     * Returns if this is the OptionMenu
+     *
+     * @return if this is the OptionMenu
+     */
     @Override
     @Override
     public boolean isOptionMenu()
     public boolean isOptionMenu()
     {
     {

+ 24 - 10
src/pathgame/rendering/HUDRenderer.java

@@ -6,15 +6,29 @@ import me.hammerle.snuviengine.api.Texture;
 import pathgame.gameplay.MinusStepsValues;
 import pathgame.gameplay.MinusStepsValues;
 import pathgame.gameplay.Player;
 import pathgame.gameplay.Player;
 
 
+/**
+ * A container for holding everything about the renderer for the Head-Up-Display
+ *
+ * @author julia
+ */
 public class HUDRenderer
 public class HUDRenderer
 {
 {
+
     public static final float OFFSET_Y = 40;
     public static final float OFFSET_Y = 40;
     private static final Texture ENERGYBAR = new Texture("resources/energyBars.png");
     private static final Texture ENERGYBAR = new Texture("resources/energyBars.png");
 
 
+    /**
+     * Recalculates the rendering positions and settings of the HUD-elements on
+     * the screen every rendertick based on the gamelogic in the gametick
+     *
+     * @param r the renderer
+     * @param p the current player
+     * @param lag the current lag
+     */
     public void renderTick(Renderer r, Player p, float lag)//TileMap map, TileMapRenderer map, float lag, float offX, float offY)
     public void renderTick(Renderer r, Player p, float lag)//TileMap map, TileMapRenderer map, float lag, float offX, float offY)
     {
     {
         r.translateTo(0.0f, 0.0f);
         r.translateTo(0.0f, 0.0f);
-        r.scale(2.0f, 2.0f);    
+        r.scale(2.0f, 2.0f);
         r.updateMatrix();
         r.updateMatrix();
 
 
         renderHUDBackgound(r);
         renderHUDBackgound(r);
@@ -24,7 +38,7 @@ public class HUDRenderer
         renderMinusEnergy(r, p, lag);
         renderMinusEnergy(r, p, lag);
     }
     }
 
 
-    void renderHUDBackgound(Renderer r)
+    private void renderHUDBackgound(Renderer r)
     {
     {
         r.setMixColorEnabled(true);
         r.setMixColorEnabled(true);
         r.setColorEnabled(true);
         r.setColorEnabled(true);
@@ -34,7 +48,7 @@ public class HUDRenderer
         r.getColorRenderer().drawRectangle(0, 0, r.getViewWidth(), 20, 0xFF_00_00_00);//ABGR
         r.getColorRenderer().drawRectangle(0, 0, r.getViewWidth(), 20, 0xFF_00_00_00);//ABGR
     }
     }
 
 
-    void renderObjectiveTracker(Renderer r, Player p)
+    private void renderObjectiveTracker(Renderer r, Player p)
     {
     {
         r.setMixColorEnabled(false);
         r.setMixColorEnabled(false);
         r.setColorEnabled(true);
         r.setColorEnabled(true);
@@ -44,7 +58,7 @@ public class HUDRenderer
         r.getFontRenderer().drawString(2, 6, objectiveTracker);
         r.getFontRenderer().drawString(2, 6, objectiveTracker);
     }
     }
 
 
-    void renderEnergyText(Renderer r, Player p)
+    private void renderEnergyText(Renderer r, Player p)
     {
     {
         r.setMixColorEnabled(false);
         r.setMixColorEnabled(false);
         r.setColorEnabled(true);
         r.setColorEnabled(true);
@@ -58,7 +72,7 @@ public class HUDRenderer
                 6, energy);
                 6, energy);
     }
     }
 
 
-    void renderEnergyBar(Renderer r, Player p)
+    private void renderEnergyBar(Renderer r, Player p)
     {
     {
         r.setMixColorEnabled(true);
         r.setMixColorEnabled(true);
         r.setColorEnabled(false);
         r.setColorEnabled(false);
@@ -66,17 +80,17 @@ public class HUDRenderer
         r.setBlendingEnabled(true);
         r.setBlendingEnabled(true);
 
 
         float energyPercent = 100 / (float) p.getEnergySupply() * (float) p.getEnergyLeft() / 100;
         float energyPercent = 100 / (float) p.getEnergySupply() * (float) p.getEnergyLeft() / 100;
-        if(energyPercent<0)
+        if(energyPercent < 0)
         {
         {
             energyPercent = 0;
             energyPercent = 0;
         }
         }
-        ENERGYBAR.bind();        
-        r.getTextureRenderer().drawRectangle(100, 5, (r.getViewWidth() / 2 - 5), 17, 0, 0.0625f, 1, 0.0625f*2);
+        ENERGYBAR.bind();
+        r.getTextureRenderer().drawRectangle(100, 5, (r.getViewWidth() / 2 - 5), 17, 0, 0.0625f, 1, 0.0625f * 2);
         r.getTextureRenderer().drawRectangle(100, 5, (((r.getViewWidth() / 2 - 5) - 100) * (energyPercent)) + 100, 17, 0, 0, 1 * energyPercent, 0.0625f);
         r.getTextureRenderer().drawRectangle(100, 5, (((r.getViewWidth() / 2 - 5) - 100) * (energyPercent)) + 100, 17, 0, 0, 1 * energyPercent, 0.0625f);
 
 
     }
     }
 
 
-    void renderMinusEnergy(Renderer r, Player p, float lag)
+    private void renderMinusEnergy(Renderer r, Player p, float lag)
     {
     {
         r.setMixColorEnabled(false);
         r.setMixColorEnabled(false);
         r.setColorEnabled(true);
         r.setColorEnabled(true);
@@ -89,4 +103,4 @@ public class HUDRenderer
             r.getFontRenderer().drawString(r.getViewWidth() * 0.5f - 63, 9 + step.getLifeTime() + lag, minusEnergy);
             r.getFontRenderer().drawString(r.getViewWidth() * 0.5f - 63, 9 + step.getLifeTime() + lag, minusEnergy);
         }
         }
     }
     }
-}
+}

+ 21 - 0
src/pathgame/rendering/LevelRenderer.java

@@ -8,6 +8,11 @@ import pathgame.gameplay.Level;
 import pathgame.gameplay.Player;
 import pathgame.gameplay.Player;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileMap;
 
 
+/**
+ * A container for holding everything about the renderer for the player
+ *
+ * @author julia
+ */
 public class LevelRenderer
 public class LevelRenderer
 {
 {
     private final PlayerRenderer playerRenderer = new PlayerRenderer();
     private final PlayerRenderer playerRenderer = new PlayerRenderer();
@@ -16,6 +21,13 @@ public class LevelRenderer
     private final Camera cam = new Camera();
     private final Camera cam = new Camera();
     private final ScoreMenuRenderer scoreRenderer = new ScoreMenuRenderer();
     private final ScoreMenuRenderer scoreRenderer = new ScoreMenuRenderer();
 
 
+    /**
+     * Calls the camera tick and the mapRenderer tick and resets the camera if
+     * the player is moving
+     *
+     * @param level a level containing the current map and the current player
+     * @param gamestate the gamestate
+     */
     public void tick(Level level, Gamestate gamestate)
     public void tick(Level level, Gamestate gamestate)
     {
     {
         cam.tick(level, gamestate);
         cam.tick(level, gamestate);
@@ -26,6 +38,15 @@ public class LevelRenderer
         }
         }
     }
     }
 
 
+    /**
+     * Recalculates the rendering position and settings of everything in the
+     * level every rendertick based on the gamelogic in the gametick
+     *
+     * @param r the renderer
+     * @param lag the current lag
+     * @param level the current level containing the map and the player
+     * @param gamestate the gamestate
+     */
     public void renderTick(Renderer r, float lag, Level level, Gamestate gamestate)
     public void renderTick(Renderer r, float lag, Level level, Gamestate gamestate)
     {
     {
         if(level.isShowingAfterScore() || level.isShowingScoreMenu())
         if(level.isShowingAfterScore() || level.isShowingScoreMenu())

+ 13 - 0
src/pathgame/rendering/MenuRenderer.java

@@ -6,10 +6,23 @@ import pathgame.gameplay.Keys;
 import pathgame.gameplay.menu.Menu;
 import pathgame.gameplay.menu.Menu;
 import pathgame.gameplay.menu.MenuButton;
 import pathgame.gameplay.menu.MenuButton;
 
 
+/**
+ * A container for holding everything about the renderer for the menus
+ *
+ * @author julia
+ */
 public class MenuRenderer
 public class MenuRenderer
 {
 {
     private final float keyWidths[] = new float[Keys.KEYS.length];
     private final float keyWidths[] = new float[Keys.KEYS.length];
 
 
+        /**
+     * Recalculates the rendering positions and settings of the menu-elements on
+     * the screen every rendertick based on the gamelogic in the gametick
+     *
+     * @param r the renderer
+     * @param lag the current lag
+     * @param menu the current menu
+     */
     public void renderTick(Renderer r, float lag, Menu menu)
     public void renderTick(Renderer r, float lag, Menu menu)
     {
     {
         r.translateTo(0.0f, 0.0f);
         r.translateTo(0.0f, 0.0f);

+ 21 - 4
src/pathgame/rendering/PlayerRenderer.java

@@ -6,10 +6,27 @@ import pathgame.gameplay.Player;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.Tiles;
 import pathgame.tilemap.Tiles;
 
 
+/**
+ * A container for holding everything about the renderer for the player
+ *
+ * @author julia
+ */
 public class PlayerRenderer
 public class PlayerRenderer
 {
 {
     private static final Texture CHARACTER = new Texture("resources/character.png");
     private static final Texture CHARACTER = new Texture("resources/character.png");
 
 
+    /**
+     * Recalculates the rendering positions and settings of the menu-elements on
+     * the screen every rendertick based on the gamelogic in the gametick
+     *
+     * @param map the current map
+     * @param mapR the map renderer
+     * @param r the renderer
+     * @param p the current player
+     * @param lag the current lag
+     * @param offX the current x-offset of the map
+     * @param offY the current y-offset of the map
+     */
     public void renderTick(TileMap map, TileMapRenderer mapR, Renderer r, Player p, float lag, float offX, float offY)
     public void renderTick(TileMap map, TileMapRenderer mapR, Renderer r, Player p, float lag, float offX, float offY)
     {
     {
         float playerSize = mapR.getScale() * TileRenderer.TILE_SIZE;
         float playerSize = mapR.getScale() * TileRenderer.TILE_SIZE;
@@ -65,20 +82,20 @@ public class PlayerRenderer
             //stand still
             //stand still
             yIndex = 0;
             yIndex = 0;
         }
         }
-        
+
         if(p.isSailing())
         if(p.isSailing())
         {
         {
             yTexOff = 0.5f;
             yTexOff = 0.5f;
         }
         }
-        else if(p.getCurrTile()== Tiles.SHALLOW_WATER)
+        else if(p.getCurrTile() == Tiles.SHALLOW_WATER)
         {
         {
             xTexOff = 0.5f;
             xTexOff = 0.5f;
         }
         }
-        
+
         float viewScale = r.getViewScale();
         float viewScale = r.getViewScale();
         ix = (int) (ix * viewScale) / viewScale;
         ix = (int) (ix * viewScale) / viewScale;
         iy = (int) (iy * viewScale) / viewScale;
         iy = (int) (iy * viewScale) / viewScale;
-        
+
         r.getTextureRenderer().drawRectangle(ix, iy, ix + playerSize, iy + playerSize,
         r.getTextureRenderer().drawRectangle(ix, iy, ix + playerSize, iy + playerSize,
                 tIndex * 0.125f + xTexOff, yIndex * 0.125f + yTexOff,
                 tIndex * 0.125f + xTexOff, yIndex * 0.125f + yTexOff,
                 (tIndex + 1) * 0.125f + xTexOff, yIndex * 0.125f + 0.125f + yTexOff);
                 (tIndex + 1) * 0.125f + xTexOff, yIndex * 0.125f + 0.125f + yTexOff);

+ 19 - 2
src/pathgame/rendering/ScoreMenuRenderer.java

@@ -3,8 +3,21 @@ package pathgame.rendering;
 import me.hammerle.snuviengine.api.Renderer;
 import me.hammerle.snuviengine.api.Renderer;
 import pathgame.gameplay.Level;
 import pathgame.gameplay.Level;
 
 
+/**
+ * A container for holding everything about the renderer for the score menu
+ *
+ * @author julia
+ */
 public class ScoreMenuRenderer
 public class ScoreMenuRenderer
 {
 {
+    /**
+     * Recalculates the rendering positions and settings of the menu-elements on
+     * the screen every rendertick based on the gamelogic in the gametick
+     *
+     * @param r the renderer
+     * @param lag the current lag
+     * @param level the current level containing the player and the map
+     */
     public void renderTick(Renderer r, float lag, Level level)
     public void renderTick(Renderer r, float lag, Level level)
     {
     {
         float windowWidth = r.getViewWidth();
         float windowWidth = r.getViewWidth();
@@ -21,7 +34,7 @@ public class ScoreMenuRenderer
         r.translateTo(0.0f, 0.0f);
         r.translateTo(0.0f, 0.0f);
         float scale = scale(r, 1);
         float scale = scale(r, 1);
 
 
-        String message = String.format("&2%d&f of &2%d&f Energy used", 
+        String message = String.format("&2%d&f of &2%d&f Energy used",
                 level.getPlayer().getEnergyUsed(), level.getPlayer().getEnergySupply());
                 level.getPlayer().getEnergyUsed(), level.getPlayer().getEnergySupply());
 
 
         r.getFontRenderer().drawString((windowWidth * scale - getWidth(r, message)) / 2, (windowHeight * scale - getHeight(r, message)) / 2 - windowHeight * scale * 0.5f * 0.15f, message);
         r.getFontRenderer().drawString((windowWidth * scale - getWidth(r, message)) / 2, (windowHeight * scale - getHeight(r, message)) / 2 - windowHeight * scale * 0.5f * 0.15f, message);
@@ -42,6 +55,10 @@ public class ScoreMenuRenderer
         {
         {
             message = "Only twice the energy use of the algorithm!";
             message = "Only twice the energy use of the algorithm!";
         }
         }
+        else if((float) level.getPlayer().getEnergyUsed() / level.getPlayer().getEnergySupply() == 1)
+        {
+            message = "As good as the algorithm!";
+        }
         else if((float) level.getPlayer().getEnergyUsed() / level.getPlayer().getEnergySupply() > 1)
         else if((float) level.getPlayer().getEnergyUsed() / level.getPlayer().getEnergySupply() > 1)
         {
         {
             message = "More than twice the energy use of the algorithm!";
             message = "More than twice the energy use of the algorithm!";
@@ -50,7 +67,7 @@ public class ScoreMenuRenderer
         r.getFontRenderer().drawString((windowWidth * scale - getWidth(r, message)) / 2, (windowHeight * scale - getHeight(r, message)) / 2 - windowHeight * scale * 0.5f * (-0.15f), message);
         r.getFontRenderer().drawString((windowWidth * scale - getWidth(r, message)) / 2, (windowHeight * scale - getHeight(r, message)) / 2 - windowHeight * scale * 0.5f * (-0.15f), message);
 
 
         scale = scale(r, 2);
         scale = scale(r, 2);
-        if((float) level.getPlayer().getEnergyUsed() / level.getPlayer().getEnergySupply() < 1)
+        if((float) level.getPlayer().getEnergyUsed() / level.getPlayer().getEnergySupply() <= 1)
         {
         {
 
 
             message = "Congratulations!";
             message = "Congratulations!";