From 82e2a0c059805202e24d249d070dd0f8e54127ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Fri, 17 Jun 2022 08:48:57 +0200 Subject: [PATCH] comment --- src/Control/Controller.java | 6 ++++++ src/Control/Keyboard.java | 6 ++++++ src/Entity/Character.java | 7 +++++++ src/Entity/Enemy.java | 19 ++++++++++++++----- src/Entity/Entity.java | 8 +++++++- src/Entity/Player.java | 25 +++++++++++++++++++++---- src/Main/Settings.java | 2 +- src/Text/TextEnemy.java | 2 +- 8 files changed, 63 insertions(+), 12 deletions(-) diff --git a/src/Control/Controller.java b/src/Control/Controller.java index 9326e6d..bf4a3fd 100644 --- a/src/Control/Controller.java +++ b/src/Control/Controller.java @@ -5,6 +5,12 @@ import java.util.TreeMap; import com.badlogic.gdx.Input; +/** + * Store key status for control the game + * @author Rémi Heredero + * @author Yann Sierro + * @version 1.0.0 + */ public class Controller { public Map keyStatus = new TreeMap(); diff --git a/src/Control/Keyboard.java b/src/Control/Keyboard.java index 3da4174..5bdd215 100644 --- a/src/Control/Keyboard.java +++ b/src/Control/Keyboard.java @@ -2,6 +2,12 @@ package Control; import Screen.ScreenPlayer; +/** + * Manage input from keyboard for write on controller + * @author Rémi Heredero + * @author Yann Sierro + * @version 1.0.0 + */ public class Keyboard { public void keyDown(int keycode, ScreenPlayer sp, Controller c) { c.keyStatus.put(keycode, true); diff --git a/src/Entity/Character.java b/src/Entity/Character.java index 998c655..f73f1f7 100644 --- a/src/Entity/Character.java +++ b/src/Entity/Character.java @@ -7,8 +7,15 @@ import com.badlogic.gdx.math.Vector2; import ch.hevs.gdx2d.components.bitmaps.Spritesheet; import ch.hevs.gdx2d.lib.GdxGraphics; +/** + * Class for manage all type of character. Player, enemy and why not some npc + * @author Rémi Heredero + * @author Yann Sierro + * @version 1.0.0 + */ public abstract class Character extends Entity{ + // Each character have a direction for orientation and where it will go public enum Direction{ UP, DOWN, diff --git a/src/Entity/Enemy.java b/src/Entity/Enemy.java index 4e2b323..9ad00ae 100644 --- a/src/Entity/Enemy.java +++ b/src/Entity/Enemy.java @@ -6,19 +6,28 @@ import Main.Settings; public class Enemy extends Character{ - private String branch; + private String subject; public int recoveredTime = Settings.RECOVERED; private int pvInit; - public Enemy(String name, int x, int y, String map, int pv, String branch) { + /** + * Create an enemy + * @param name The name of this enemy + * @param x Initial x position + * @param y Initial y position + * @param map Initial map for this enemy + * @param pv Maximum pv of this enemy (it's also the maximum of XP the player can win) + * @param subject The subject taught by the enemy + */ + public Enemy(String name, int x, int y, String map, int pv, String subject) { - super(name, x, y, branch, map); + super(name, x, y, subject, map); //generate his text this.map = map; - this.branch = branch; + this.subject = subject; this.pv = pv; @@ -42,7 +51,7 @@ public class Enemy extends Character{ } public String getBranch(){ - return branch; + return subject; } @Override diff --git a/src/Entity/Entity.java b/src/Entity/Entity.java index f9f6280..ae9b81c 100644 --- a/src/Entity/Entity.java +++ b/src/Entity/Entity.java @@ -6,6 +6,13 @@ import ch.hevs.gdx2d.components.bitmaps.Spritesheet; import ch.hevs.gdx2d.lib.GdxGraphics; import ch.hevs.gdx2d.lib.interfaces.DrawableObject; +/** + * Main class for manage entity + * Can create all type of entity character or just stuff. + * @author Rémi Heredero + * @author Yann Sierro + * @version 1.0.0 + */ public abstract class Entity implements DrawableObject { protected String name; protected String map; @@ -51,7 +58,6 @@ public abstract class Entity implements DrawableObject { } public void graphicRender(GdxGraphics g){ - } /** diff --git a/src/Entity/Player.java b/src/Entity/Player.java index 5c2b878..2838173 100644 --- a/src/Entity/Player.java +++ b/src/Entity/Player.java @@ -18,8 +18,14 @@ public class Player extends Character{ public boolean onEnemy = false; private static final int XP_MAX = 6000; - public Player(int x, int y, String map) { - super("Player", x, y, "sprite_sacha", map); //Character_flipped + /** + * Create a player + * @param x initial x position + * @param y initial y position + * @param map initial map + */ + public Player(int x, int y, String map) { + super("Player", x, y, "sprite_sacha", map); this.pv = Settings.TIME*60; } @@ -31,7 +37,12 @@ public class Player extends Character{ return xp; } - public void manageEntity(ScreenMap sm, Controller c) { + /** + * All action for manage the Player + * @param sm the screenMap where is the player + * @param c the controller of this player + */ + public void manageEntity(ScreenMap sm, Controller c) { boolean onDoor = sm.isDoor(getPosition()); @@ -102,7 +113,13 @@ public class Player extends Character{ } } - private boolean enemy(ScreenMap sm, Vector2 nextPos) { + /** + * Return true if an enemy is on next position + * @param sm Screen map where is the player + * @param nextPos Vector of next position + * @return true if an enemy is on next position + */ + private boolean enemy(ScreenMap sm, Vector2 nextPos) { Vector enemies = PokeMudry.getEnemies(); for (Enemy enemy : enemies) { boolean bMap = sm.map.equals(enemy.getMap()); diff --git a/src/Main/Settings.java b/src/Main/Settings.java index 32b03ee..88c383c 100644 --- a/src/Main/Settings.java +++ b/src/Main/Settings.java @@ -4,7 +4,7 @@ public class Settings { public static final boolean ANDROID = false; public static final int PLAYERS = 1; - public static final int TIME = 10; // number of minutes for kill all enemy // should be 10 + public static final int TIME = 15; // number of minutes for kill all enemy // should be 10 public static final int RECOVERED = 30; // number of seconds an enemy need for recovered public static final int SWITCH_MAP_TIME = 250; // Number of milliseconds the player wait for switch map diff --git a/src/Text/TextEnemy.java b/src/Text/TextEnemy.java index 35fb27b..97017a5 100644 --- a/src/Text/TextEnemy.java +++ b/src/Text/TextEnemy.java @@ -6,7 +6,7 @@ import java.util.Arrays; import java.util.Random; public class TextEnemy { - private static final int CUT = 60; + private static final int CUT = 55; public FightData fightData; public SpeechData speechData;