mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 13:19:17 +00:00 
			
		
		
		
	@@ -25,6 +25,7 @@ public class Controller {
 | 
				
			|||||||
        keyStatus.put(Input.Keys.NUM_3, false);
 | 
					        keyStatus.put(Input.Keys.NUM_3, false);
 | 
				
			||||||
        keyStatus.put(Input.Keys.NUM_4, false);
 | 
					        keyStatus.put(Input.Keys.NUM_4, false);
 | 
				
			||||||
        keyStatus.put(Input.Keys.SPACE, false);
 | 
					        keyStatus.put(Input.Keys.SPACE, false);
 | 
				
			||||||
 | 
					        keyStatus.put(Input.Keys.A, false);
 | 
				
			||||||
        keyStatus.put(Input.Keys.ENTER, false);
 | 
					        keyStatus.put(Input.Keys.ENTER, false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
package Control;
 | 
					package Control;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.badlogic.gdx.Input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Screen.ScreenPlayer;
 | 
					import Screen.ScreenPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -10,9 +12,11 @@ import Screen.ScreenPlayer;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public class Keyboard {
 | 
					public class Keyboard {
 | 
				
			||||||
    public void keyDown(int keycode, ScreenPlayer sp, Controller c) {
 | 
					    public void keyDown(int keycode, ScreenPlayer sp, Controller c) {
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.SPACE) c.keyStatus.put(Input.Keys.A, true);
 | 
				
			||||||
        c.keyStatus.put(keycode, true);
 | 
					        c.keyStatus.put(keycode, true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public void onKeyUp(int keycode, ScreenPlayer sp, Controller c) {
 | 
					    public void onKeyUp(int keycode, ScreenPlayer sp, Controller c) {
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.SPACE) c.keyStatus.put(Input.Keys.A, false);
 | 
				
			||||||
        c.keyStatus.put(keycode, false);
 | 
					        c.keyStatus.put(keycode, false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,11 @@ import com.badlogic.gdx.math.Vector2;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import Main.Settings; 
 | 
					import Main.Settings; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Enemy extends Character{
 | 
					public class Enemy extends Character{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String subject;
 | 
					    private String subject;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,11 @@ import Main.PokeHES;
 | 
				
			|||||||
import Main.Settings;
 | 
					import Main.Settings;
 | 
				
			||||||
import Screen.ScreenMap;
 | 
					import Screen.ScreenMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Player extends Character{
 | 
					public class Player extends Character{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int xp = 0;
 | 
					    private int xp = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,11 @@ package Entity;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Stuff extends Entity{
 | 
					public class Stuff extends Entity{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Stuff(String name, int x, int y, String map) {
 | 
					    public Stuff(String name, int x, int y, String map) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,11 @@ import Entity.Enemy;
 | 
				
			|||||||
import Entity.Player;
 | 
					import Entity.Player;
 | 
				
			||||||
import Text.TextEnemy;
 | 
					import Text.TextEnemy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.2
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Battle {
 | 
					public class Battle {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Enemy e;
 | 
					    public Enemy e;
 | 
				
			||||||
@@ -18,12 +23,14 @@ public class Battle {
 | 
				
			|||||||
    public int xpPlayer;
 | 
					    public int xpPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean screenBattleOn = true;
 | 
					    public boolean screenBattleOn = true;
 | 
				
			||||||
 | 
					    public int cursor = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Battle(Enemy e){
 | 
					    public Battle(Enemy e){
 | 
				
			||||||
        if(e != null){
 | 
					        if(e != null){
 | 
				
			||||||
            textEnemy = new TextEnemy(e);  
 | 
					            textEnemy = new TextEnemy(e);  
 | 
				
			||||||
            textEnemy.generateText();
 | 
					            textEnemy.generateText(cursor);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        pvEnemy = e.getPv();
 | 
					        pvEnemy = e.getPv();
 | 
				
			||||||
        lineSpeech = 0;
 | 
					        lineSpeech = 0;
 | 
				
			||||||
        newXp = 0;
 | 
					        newXp = 0;
 | 
				
			||||||
@@ -31,17 +38,14 @@ public class Battle {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public void readNextLine(){
 | 
					    public void readNextLine(){
 | 
				
			||||||
    //change line
 | 
					    //change line
 | 
				
			||||||
    System.out.println(textEnemy.lines.size());
 | 
					    //System.out.println(textEnemy.lines.size());
 | 
				
			||||||
        if(lineSpeech < 5){
 | 
					        if(lineSpeech < 5){
 | 
				
			||||||
            lineSpeech++;
 | 
					            lineSpeech++;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void action(int answer){
 | 
					    public void action(int answer){
 | 
				
			||||||
        System.out.println("pv enemy : " +pvEnemy);
 | 
					        textEnemy.randomAnswer();
 | 
				
			||||||
        System.out.println("xp player : " + xpPlayer);
 | 
					 | 
				
			||||||
        System.out.println("xp win " + newXp);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
       //the player is at the last question, the finish text must be displayed
 | 
					       //the player is at the last question, the finish text must be displayed
 | 
				
			||||||
        if(getLineSpeech() == 4){
 | 
					        if(getLineSpeech() == 4){
 | 
				
			||||||
@@ -96,10 +100,10 @@ public class Battle {
 | 
				
			|||||||
    public void updatePlayerEnemy(int xp){
 | 
					    public void updatePlayerEnemy(int xp){
 | 
				
			||||||
        //add xp for the player
 | 
					        //add xp for the player
 | 
				
			||||||
        xpPlayer += xp;
 | 
					        xpPlayer += xp;
 | 
				
			||||||
 | 
					        if(xpPlayer>6000) xpPlayer = 6000;
 | 
				
			||||||
        //remove pv enemy
 | 
					        //remove pv enemy
 | 
				
			||||||
        pvEnemy -= xp;
 | 
					        pvEnemy -= xp;
 | 
				
			||||||
        if(pvEnemy<0) pvEnemy =0;
 | 
					        if(pvEnemy<0) pvEnemy =0;
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void finishSpeech(){
 | 
					    public void finishSpeech(){
 | 
				
			||||||
@@ -156,4 +160,8 @@ public class Battle {
 | 
				
			|||||||
    public void setPlayer(Player p){
 | 
					    public void setPlayer(Player p){
 | 
				
			||||||
        this.player = p;
 | 
					        this.player = p;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void updateText(){
 | 
				
			||||||
 | 
					        if(e != null) textEnemy.generateText(cursor);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,8 @@ package Main;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.badlogic.gdx.Input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Control.Controller;
 | 
					import Control.Controller;
 | 
				
			||||||
import Entity.Enemy;
 | 
					import Entity.Enemy;
 | 
				
			||||||
import Entity.Entity;
 | 
					import Entity.Entity;
 | 
				
			||||||
@@ -13,6 +15,11 @@ import Screen.ScreenPlayer;
 | 
				
			|||||||
import ch.hevs.gdx2d.desktop.PortableApplication;
 | 
					import ch.hevs.gdx2d.desktop.PortableApplication;
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.2
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class PokeHES extends PortableApplication {
 | 
					public class PokeHES extends PortableApplication {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ScreenPlayer sp;
 | 
					    private ScreenPlayer sp;
 | 
				
			||||||
@@ -144,14 +151,16 @@ public class PokeHES extends PortableApplication {
 | 
				
			|||||||
    public void onKeyDown(int keycode) {
 | 
					    public void onKeyDown(int keycode) {
 | 
				
			||||||
        super.onKeyDown(keycode);
 | 
					        super.onKeyDown(keycode);
 | 
				
			||||||
        risingFront = true;
 | 
					        risingFront = true;
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.SPACE) controller.keyStatus.put(Input.Keys.A, true);
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.ENTER) controller.keyStatus.put(Input.Keys.A, true);
 | 
				
			||||||
        controller.keyStatus.put(keycode, true);
 | 
					        controller.keyStatus.put(keycode, true);
 | 
				
			||||||
        sp.screenManager.getActiveScreen().onKeyUp(keycode);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onKeyUp(int keycode) {
 | 
					    public void onKeyUp(int keycode) {
 | 
				
			||||||
        super.onKeyUp(keycode);
 | 
					        super.onKeyUp(keycode);
 | 
				
			||||||
        risingFront = false;
 | 
					        risingFront = false;
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.SPACE) controller.keyStatus.put(Input.Keys.A, false);
 | 
				
			||||||
 | 
					        if (keycode == Input.Keys.ENTER) controller.keyStatus.put(Input.Keys.A, false);
 | 
				
			||||||
        controller.keyStatus.put(keycode, false);
 | 
					        controller.keyStatus.put(keycode, false);
 | 
				
			||||||
        sp.screenManager.getActiveScreen().onKeyDown(keycode);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,10 @@
 | 
				
			|||||||
package Main;
 | 
					package Main;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Settings {
 | 
					public class Settings {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static final boolean ANDROID = false; 
 | 
					    public static final boolean ANDROID = false; 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,11 @@ package Screen;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import ch.hevs.gdx2d.lib.ScreenManager;
 | 
					import ch.hevs.gdx2d.lib.ScreenManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class ManagerOfScreen extends ScreenManager{
 | 
					public class ManagerOfScreen extends ScreenManager{
 | 
				
			||||||
    ManagerOfScreen(){
 | 
					    ManagerOfScreen(){
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,11 @@ import ch.hevs.gdx2d.components.bitmaps.BitmapImage;
 | 
				
			|||||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
					import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.2
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class ScreenBattle extends RenderingScreen{
 | 
					public class ScreenBattle extends RenderingScreen{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static int EDGE = 10;
 | 
						private static int EDGE = 10;
 | 
				
			||||||
@@ -28,7 +33,7 @@ public class ScreenBattle extends RenderingScreen{
 | 
				
			|||||||
	private BitmapImage enemyImg;
 | 
						private BitmapImage enemyImg;
 | 
				
			||||||
	private BitmapImage playerImg;
 | 
						private BitmapImage playerImg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private Battle b = null;
 | 
						public Battle b = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@@ -109,27 +114,43 @@ public class ScreenBattle extends RenderingScreen{
 | 
				
			|||||||
	public void manage(Controller c, Battle battle){
 | 
						public void manage(Controller c, Battle battle){
 | 
				
			||||||
		//add a rising front to have one impulsion
 | 
							//add a rising front to have one impulsion
 | 
				
			||||||
		if(PokeHES.risingFront){
 | 
							if(PokeHES.risingFront){
 | 
				
			||||||
			//the enemi is attacking
 | 
								
 | 
				
			||||||
			if( battle.getAttackOn() == false){
 | 
								if (c.keyStatus.get(Input.Keys.DOWN)){
 | 
				
			||||||
				if (c.keyStatus.get(Input.Keys.SPACE)){
 | 
									battle.cursor++;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else if (c.keyStatus.get(Input.Keys.UP)){
 | 
				
			||||||
 | 
									battle.cursor--;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (battle.cursor > 3) battle.cursor = 0;
 | 
				
			||||||
 | 
								if (battle.cursor < 0) battle.cursor = 3;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								if( battle.getAttackOn() == false){ //the enemy is attacking
 | 
				
			||||||
 | 
									if (c.keyStatus.get(Input.Keys.SPACE) || c.keyStatus.get(Input.Keys.A)){
 | 
				
			||||||
					battle.action(-1);
 | 
										battle.action(-1);
 | 
				
			||||||
 | 
										battle.cursor = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								} else if(battle.getAttackOn() == true){ //the enemy is speaking
 | 
				
			||||||
			//the enemi is speaking
 | 
									if (c.keyStatus.get(Input.Keys.NUM_1) || c.keyStatus.get(Input.Keys.A) && b.cursor == 0){
 | 
				
			||||||
			if(battle.getAttackOn() == true){
 | 
					 | 
				
			||||||
				if (c.keyStatus.get(Input.Keys.NUM_1)){
 | 
					 | 
				
			||||||
					battle.action(1);
 | 
										battle.action(1);
 | 
				
			||||||
 | 
										battle.cursor = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else if (c.keyStatus.get(Input.Keys.NUM_2)){
 | 
									else if (c.keyStatus.get(Input.Keys.NUM_2) || c.keyStatus.get(Input.Keys.A) && b.cursor == 1){
 | 
				
			||||||
					battle.action(2);
 | 
										battle.action(2);
 | 
				
			||||||
 | 
										battle.cursor = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else if (c.keyStatus.get(Input.Keys.NUM_3)){
 | 
									else if (c.keyStatus.get(Input.Keys.NUM_3) || c.keyStatus.get(Input.Keys.A) && b.cursor == 2){
 | 
				
			||||||
					battle.action(3);
 | 
										battle.action(3);
 | 
				
			||||||
 | 
										battle.cursor = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else if (c.keyStatus.get(Input.Keys.NUM_4)){
 | 
									else if (c.keyStatus.get(Input.Keys.NUM_4) || c.keyStatus.get(Input.Keys.A) && b.cursor == 3){
 | 
				
			||||||
					battle.action(4);
 | 
										battle.action(4);
 | 
				
			||||||
 | 
										battle.cursor = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								b.updateText();
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			//mettre le front à false jusqu'à ce que le bouton soit relâché
 | 
								//mettre le front à false jusqu'à ce que le bouton soit relâché
 | 
				
			||||||
			PokeHES.risingFront = false;
 | 
								PokeHES.risingFront = false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,15 +12,20 @@ import Main.Settings;
 | 
				
			|||||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
					import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class ScreenEnd extends RenderingScreen{
 | 
					public class ScreenEnd extends RenderingScreen{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String textEnd = null;
 | 
					    private String textEnd = null;
 | 
				
			||||||
    private BitmapFont unbuntuRegularWhite;
 | 
					    private BitmapFont ubuntuRegularWhite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onInit() {
 | 
					    public void onInit() {
 | 
				
			||||||
        //generate a new font
 | 
					        //generate a new font
 | 
				
			||||||
        unbuntuRegularWhite = generateFont("font/Ubuntu-Regular.ttf", 30, Color.WHITE);
 | 
					        ubuntuRegularWhite = generateFont("font/Ubuntu-Regular.ttf", 30, Color.WHITE);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -30,13 +35,13 @@ public class ScreenEnd extends RenderingScreen{
 | 
				
			|||||||
        g.clear(Color.BLACK);
 | 
					        g.clear(Color.BLACK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //display the text
 | 
					        //display the text
 | 
				
			||||||
        if(textEnd != null) g.drawStringCentered(Settings.SIDE/2, textEnd, unbuntuRegularWhite);
 | 
					        if(textEnd != null) g.drawStringCentered(Settings.SIDE/2, textEnd, ubuntuRegularWhite);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
	public void dispose() {
 | 
						public void dispose() {
 | 
				
			||||||
		unbuntuRegularWhite.dispose();
 | 
							ubuntuRegularWhite.dispose();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //set a different text if the player win or loose
 | 
					    //set a different text if the player win or loose
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,11 @@ import Entity.Player;
 | 
				
			|||||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
					import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.1
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class ScreenMap extends RenderingScreen{
 | 
					public class ScreenMap extends RenderingScreen{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// tiles management
 | 
						// tiles management
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,11 @@ import Entity.Player;
 | 
				
			|||||||
import Game.Battle;
 | 
					import Game.Battle;
 | 
				
			||||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
					import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class ScreenPlayer {
 | 
					public class ScreenPlayer {
 | 
				
			||||||
    public ManagerOfScreen screenManager = new ManagerOfScreen();
 | 
					    public ManagerOfScreen screenManager = new ManagerOfScreen();
 | 
				
			||||||
    public Player p = null;
 | 
					    public Player p = null;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,10 @@
 | 
				
			|||||||
package Text;
 | 
					package Text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Attack {
 | 
					public class Attack {
 | 
				
			||||||
    String attack;
 | 
					    String attack;
 | 
				
			||||||
    int currentAttack;
 | 
					    int currentAttack;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,11 @@ import java.io.InputStreamReader;
 | 
				
			|||||||
import java.nio.charset.StandardCharsets;
 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class FightData {
 | 
					public class FightData {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private  Vector<Attack> attacks = new Vector<Attack>();
 | 
					    private  Vector<Attack> attacks = new Vector<Attack>();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,10 @@
 | 
				
			|||||||
package Text;
 | 
					package Text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class Line {
 | 
					public class Line {
 | 
				
			||||||
    public String line;
 | 
					    public String line;
 | 
				
			||||||
    public boolean attackOn;
 | 
					    public boolean attackOn;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,11 @@ import java.io.InputStreamReader;
 | 
				
			|||||||
import java.nio.charset.StandardCharsets;
 | 
					import java.nio.charset.StandardCharsets;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.0
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class SpeechData {
 | 
					public class SpeechData {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Vector<String> speechs = new Vector<String>();
 | 
					    Vector<String> speechs = new Vector<String>();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,11 @@ import java.util.Vector;
 | 
				
			|||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Random;
 | 
					import java.util.Random;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Rémi Heredero
 | 
				
			||||||
 | 
					 * @author Yann Sierro
 | 
				
			||||||
 | 
					 * @version 1.0.2
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public class TextEnemy {
 | 
					public class TextEnemy {
 | 
				
			||||||
    private static final int CUT = 55;
 | 
					    private static final int CUT = 55;
 | 
				
			||||||
    public FightData fightData;
 | 
					    public FightData fightData;
 | 
				
			||||||
@@ -17,6 +22,8 @@ public class TextEnemy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private Vector<int[]> currentData;
 | 
					    private Vector<int[]> currentData;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    int[] currentRandom = new int[5];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public TextEnemy(Enemy e){
 | 
					    public TextEnemy(Enemy e){
 | 
				
			||||||
        //generate the vector of fight
 | 
					        //generate the vector of fight
 | 
				
			||||||
        fightData = new FightData(e.getBranch());
 | 
					        fightData = new FightData(e.getBranch());
 | 
				
			||||||
@@ -29,6 +36,20 @@ public class TextEnemy {
 | 
				
			|||||||
        //save random data (attack and answer) : attack, answer 1, answer 2 answer 3, answer 4
 | 
					        //save random data (attack and answer) : attack, answer 1, answer 2 answer 3, answer 4
 | 
				
			||||||
        currentData = new Vector<int[]>();
 | 
					        currentData = new Vector<int[]>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        randomAnswer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void randomAnswer(){
 | 
				
			||||||
 | 
					        //generate a random array to determine the order of the answer
 | 
				
			||||||
 | 
					        orderAnswer = randomGenerate(0, 3, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //save the order of answer and attack
 | 
				
			||||||
 | 
					        for(int k=1;k<5;k++){
 | 
				
			||||||
 | 
					            currentRandom[k] = orderAnswer[k-1];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static int[] randomGenerate( int min, int max, int nbrRandom){
 | 
					    public static int[] randomGenerate( int min, int max, int nbrRandom){
 | 
				
			||||||
@@ -66,33 +87,29 @@ public class TextEnemy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //generate the text who is displays in battle screen
 | 
					    //generate the text who is displays in battle screen
 | 
				
			||||||
    public void generateText(){
 | 
					    public void generateText(int cursor){
 | 
				
			||||||
 | 
					        lines.clear();
 | 
				
			||||||
 | 
					        currentData.clear();
 | 
				
			||||||
        int i =1;
 | 
					        int i =1;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        //introduction line
 | 
					        //introduction line
 | 
				
			||||||
        String introduction = formatLine(speechData.getSpeechs(0), CUT);
 | 
					        String introduction = formatLine(speechData.getSpeechs(0), CUT);
 | 
				
			||||||
        lines.add(new Line(introduction, false));
 | 
					        lines.add(new Line(introduction, false));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
					        //orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for(int j=0; j<4;j++){
 | 
					        for(int j=0; j<4;j++){
 | 
				
			||||||
            int[] currentRandom = new int[5];
 | 
					 | 
				
			||||||
            currentRandom[0] = orderAttack[j];
 | 
					            currentRandom[0] = orderAttack[j];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //generate a random array to determine the order of the answer
 | 
					 | 
				
			||||||
            orderAnswer = randomGenerate(0, 3, 4);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //save the order of answer and attack
 | 
					 | 
				
			||||||
            for(int k=1;k<5;k++){
 | 
					 | 
				
			||||||
                currentRandom[k] = orderAnswer[k-1];
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Format the line
 | 
					            //Format the line
 | 
				
			||||||
 | 
					            String[] row = new String[4];
 | 
				
			||||||
 | 
					            row[0] = row[1] = row[2] = row[3] = "    ";
 | 
				
			||||||
 | 
					            row[cursor] = "->";
 | 
				
			||||||
            String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + "  ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT);
 | 
					            String attack = formatLine(speechData.getSpeechs(i++) + fightData.getAttack(orderAttack[j]).attack + "  ("+fightData.getAttack(orderAttack[j]).getXp()+ ") ", CUT);
 | 
				
			||||||
            String answer1 = formatLine("1. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT);
 | 
					            String answer1 = formatLine(row[0] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[0]) , CUT);
 | 
				
			||||||
            String answer2 = formatLine("2. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT);
 | 
					            String answer2 = formatLine(row[1] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[1]) , CUT);
 | 
				
			||||||
            String answer3 = formatLine("3. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT);
 | 
					            String answer3 = formatLine(row[2] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[2]) , CUT);
 | 
				
			||||||
            String answer4 = formatLine("4. " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[3]) , CUT);
 | 
					            String answer4 = formatLine(row[3] + " " + fightData.getAttack(orderAttack[j]).getAnswer(orderAnswer[3]) , CUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //attack and answer (number on vector : 1-4)
 | 
					            //attack and answer (number on vector : 1-4)
 | 
				
			||||||
            lines.add(new Line(attack + "\n" +answer1 + "\n" + answer2 + "\n" + answer3 + "\n" + answer4, true));
 | 
					            lines.add(new Line(attack + "\n" +answer1 + "\n" + answer2 + "\n" + answer3 + "\n" + answer4, true));
 | 
				
			||||||
@@ -102,11 +119,11 @@ public class TextEnemy {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        //display answer
 | 
					        //display answer
 | 
				
			||||||
 | 
					        System.out.println("----------");
 | 
				
			||||||
        for(int[] a : currentData){
 | 
					        for(int[] a : currentData){
 | 
				
			||||||
            System.out.println(Arrays.toString(a));
 | 
					            System.out.println(Arrays.toString(a));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					 | 
				
			||||||
        //finish (win and death)
 | 
					        //finish (win and death)
 | 
				
			||||||
        String dead = formatLine(speechData.getSpeechs(5),CUT);
 | 
					        String dead = formatLine(speechData.getSpeechs(5),CUT);
 | 
				
			||||||
        String alive = formatLine(speechData.getSpeechs(6), CUT);
 | 
					        String alive = formatLine(speechData.getSpeechs(6), CUT);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user