Add missing documenation

Remove language from game panel

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2019-09-29 22:18:17 -03:00
parent fe4c7f1130
commit 4f65862177
6 changed files with 86 additions and 8 deletions

View File

@ -127,11 +127,19 @@ public class Celda extends JComponent implements Constantes {
textureNumbers.add(textureNumber); textureNumbers.add(textureNumber);
} }
/**
* Remove the texture that is on the top of the stack
*/
public void removeTopTexture() { public void removeTopTexture() {
textures.remove(textures.size() - 1); textures.remove(textures.size() - 1);
textureNumbers.remove(textureNumbers.size() - 1); textureNumbers.remove(textureNumbers.size() - 1);
} }
/**
* Get the numbers of the textures
*
* @return Returns an array list containing the texture numbers
*/
public ArrayList<Integer> getTextureNumbers() { public ArrayList<Integer> getTextureNumbers() {
return textureNumbers; return textureNumbers;
} }
@ -194,12 +202,33 @@ public class Celda extends JComponent implements Constantes {
* The possible types of cell that this could be * The possible types of cell that this could be
*/ */
public enum Type { public enum Type {
/**
* The player
*/
PLAYER, PLAYER,
/**
* An enemy
*/
ENEMY, ENEMY,
/**
* An empty space
*/
SPACE, SPACE,
/**
* The portal
*/
PORTAL, PORTAL,
/**
* An obstacle
*/
OBSTACLE, OBSTACLE,
/**
* A chest
*/
CHEST, CHEST,
/**
* A key
*/
KEY KEY
} }
} }

View File

@ -173,6 +173,12 @@ public class Enemy extends Object implements Constantes {
} }
} }
/**
* If the enemy has found the player attack him
*
* @param x The x position of the player
* @param y The y position of the player
*/
private void attackPlayer(int x, int y) { private void attackPlayer(int x, int y) {
if (getEscenario().getCanvas().getPlayer().getHealth() > 0) { if (getEscenario().getCanvas().getPlayer().getHealth() > 0) {
logger.info("Attacked player at x: " + x + " y: " + y); logger.info("Attacked player at x: " + x + " y: " + y);
@ -223,9 +229,21 @@ public class Enemy extends Object implements Constantes {
* The possible directions the enemy can face * The possible directions the enemy can face
*/ */
public enum Direction { public enum Direction {
/**
* The enemy is facing up
*/
UP, UP,
/**
* The enemy is facing down
*/
DOWN, DOWN,
/**
* The enemy is facing left
*/
LEFT, LEFT,
/**
* The enemy is facing right
*/
RIGHT RIGHT
} }
} }

View File

@ -41,6 +41,12 @@ public class Gem extends Object {
PURIFIED PURIFIED
} }
/**
* Initialize the gem object
*
* @param escenario The scene the gem is in
* @param celda The cell the gem is in
*/
public Gem(Escenario escenario, Celda celda) { public Gem(Escenario escenario, Celda celda) {
super(escenario, celda); super(escenario, celda);
} }

View File

@ -127,7 +127,13 @@ public class Portal extends Object implements Constantes {
* The current state of the portal * The current state of the portal
*/ */
public enum State { public enum State {
/**
* The portal is active
*/
ACTIVE, ACTIVE,
/**
* The portal is inactive
*/
INACTIVE INACTIVE
} }
} }

View File

@ -52,12 +52,4 @@ public class Game extends JPanel implements Constantes {
public Lienzo getCanvas() { public Lienzo getCanvas() {
return canvas; return canvas;
} }
/**
* The language to use in the game
*/
public enum Language {
ENGLISH,
SPANISH
}
} }

View File

@ -213,14 +213,41 @@ public class Animation implements Cloneable, Constantes {
* The sprite type * The sprite type
*/ */
public enum SpriteType { public enum SpriteType {
/**
* The player animation
*/
PLAYER, PLAYER,
/**
* The enemy animation
*/
ENEMY, ENEMY,
/**
* The chest animation
*/
CHEST, CHEST,
/**
* The gem animation
*/
GEM, GEM,
/**
* The key animation
*/
KEY, KEY,
/**
* The heart animation
*/
HEART, HEART,
/**
* The game over animation
*/
GAME_OVER, GAME_OVER,
/**
* The inactive portal animation
*/
INACTIVE_PORTAL, INACTIVE_PORTAL,
/**
* The active portal animation
*/
ACTIVE_PORTAL ACTIVE_PORTAL
} }