mirror of
https://github.com/Klagarge/PokeHES.git
synced 2024-11-26 19:13:27 +00:00
comment
This commit is contained in:
parent
42ddda4ae4
commit
82e2a0c059
@ -5,6 +5,12 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
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 class Controller {
|
||||||
public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
|
public Map<Integer, Boolean> keyStatus = new TreeMap<Integer, Boolean>();
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@ package Control;
|
|||||||
|
|
||||||
import Screen.ScreenPlayer;
|
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 class Keyboard {
|
||||||
public void keyDown(int keycode, ScreenPlayer sp, Controller c) {
|
public void keyDown(int keycode, ScreenPlayer sp, Controller c) {
|
||||||
c.keyStatus.put(keycode, true);
|
c.keyStatus.put(keycode, true);
|
||||||
|
@ -7,8 +7,15 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
|
import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
|
||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
|
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{
|
public abstract class Character extends Entity{
|
||||||
|
|
||||||
|
// Each character have a direction for orientation and where it will go
|
||||||
public enum Direction{
|
public enum Direction{
|
||||||
UP,
|
UP,
|
||||||
DOWN,
|
DOWN,
|
||||||
|
@ -6,19 +6,28 @@ import Main.Settings;
|
|||||||
|
|
||||||
public class Enemy extends Character{
|
public class Enemy extends Character{
|
||||||
|
|
||||||
private String branch;
|
private String subject;
|
||||||
public int recoveredTime = Settings.RECOVERED;
|
public int recoveredTime = Settings.RECOVERED;
|
||||||
|
|
||||||
private int pvInit;
|
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
|
//generate his text
|
||||||
|
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|
||||||
this.branch = branch;
|
this.subject = subject;
|
||||||
|
|
||||||
this.pv = pv;
|
this.pv = pv;
|
||||||
|
|
||||||
@ -42,7 +51,7 @@ public class Enemy extends Character{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getBranch(){
|
public String getBranch(){
|
||||||
return branch;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,13 @@ import ch.hevs.gdx2d.components.bitmaps.Spritesheet;
|
|||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
|
import ch.hevs.gdx2d.lib.GdxGraphics;
|
||||||
import ch.hevs.gdx2d.lib.interfaces.DrawableObject;
|
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 {
|
public abstract class Entity implements DrawableObject {
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String map;
|
protected String map;
|
||||||
@ -51,7 +58,6 @@ public abstract class Entity implements DrawableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void graphicRender(GdxGraphics g){
|
public void graphicRender(GdxGraphics g){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,8 +18,14 @@ public class Player extends Character{
|
|||||||
public boolean onEnemy = false;
|
public boolean onEnemy = false;
|
||||||
private static final int XP_MAX = 6000;
|
private static final int XP_MAX = 6000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
public Player(int x, int y, String map) {
|
||||||
super("Player", x, y, "sprite_sacha", map); //Character_flipped
|
super("Player", x, y, "sprite_sacha", map);
|
||||||
this.pv = Settings.TIME*60;
|
this.pv = Settings.TIME*60;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +37,11 @@ public class Player extends Character{
|
|||||||
return xp;
|
return xp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
public void manageEntity(ScreenMap sm, Controller c) {
|
||||||
|
|
||||||
boolean onDoor = sm.isDoor(getPosition());
|
boolean onDoor = sm.isDoor(getPosition());
|
||||||
@ -102,6 +113,12 @@ public class Player extends Character{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
private boolean enemy(ScreenMap sm, Vector2 nextPos) {
|
||||||
Vector<Enemy> enemies = PokeMudry.getEnemies();
|
Vector<Enemy> enemies = PokeMudry.getEnemies();
|
||||||
for (Enemy enemy : enemies) {
|
for (Enemy enemy : enemies) {
|
||||||
|
@ -4,7 +4,7 @@ public class Settings {
|
|||||||
|
|
||||||
public static final boolean ANDROID = false;
|
public static final boolean ANDROID = false;
|
||||||
public static final int PLAYERS = 1;
|
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 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
|
public static final int SWITCH_MAP_TIME = 250; // Number of milliseconds the player wait for switch map
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class TextEnemy {
|
public class TextEnemy {
|
||||||
private static final int CUT = 60;
|
private static final int CUT = 55;
|
||||||
public FightData fightData;
|
public FightData fightData;
|
||||||
public SpeechData speechData;
|
public SpeechData speechData;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user