From 8c8c59411d522eca00c55c3035b3cc786a8491b0 Mon Sep 17 00:00:00 2001 From: Fastium <79766552+Fastium@users.noreply.github.com> Date: Wed, 15 Jun 2022 19:52:31 +0200 Subject: [PATCH] a --- src/Entity/Enemy.java | 4 --- src/Screen/ScreenBattle.java | 2 -- src/testYann.java | 59 ++++++++++++++++++++++++++++++++++-- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/Entity/Enemy.java b/src/Entity/Enemy.java index bb41e67..851f745 100644 --- a/src/Entity/Enemy.java +++ b/src/Entity/Enemy.java @@ -6,8 +6,6 @@ public class Enemy extends Character{ private String branch; - - public Enemy(String name, int x, int y, String img, String map, int pv, String branch) { super(name, x, y, img, map); //generate his text @@ -19,8 +17,6 @@ public class Enemy extends Character{ this.branch = branch; this.pv = pv; - - } public void setPosition(int x, int y, String map){ diff --git a/src/Screen/ScreenBattle.java b/src/Screen/ScreenBattle.java index f2691f7..512a609 100644 --- a/src/Screen/ScreenBattle.java +++ b/src/Screen/ScreenBattle.java @@ -31,14 +31,12 @@ public class ScreenBattle extends RenderingScreen{ public void onInit() { //display the question generateFont("resources/font/Ubuntu-Regular.ttf", 30, Color.BLACK); - } @Override public void onGraphicRender(GdxGraphics g) { g.clear(Color.BLACK); - displayDialog(g); } diff --git a/src/testYann.java b/src/testYann.java index 735fc47..b63ea5e 100644 --- a/src/testYann.java +++ b/src/testYann.java @@ -14,10 +14,63 @@ import java.util.RandomAccess; class testYann{ public static void main(String[] args) { - FightData t = new FightData("enemi"); - t.readFile(); + + String line = "Je vais te manger tout cru, dans le creux de ma main et tu verra rien du tout."; + String cutLine = ""; + String newLine = ""; - System.out.println(t.getAttack(1).getAnswer(0).toString()); + int cut = 25; + + int startC = 0; + int stoppC = cut; + + + char[] c = new char[line.length()]; + + for(int i=0; i=startC; i--){ + if(c[i] == ' '){ + stoppC = i; + break; + } + else if(stoppC == c.length-1){ + break; + } + } + + //découper le mot + for(int i=startC;i<=stoppC;i++){ + cutLine += c[i]; + } + + newLine += "\n" + cutLine; + cutLine = ""; + + startC = stoppC + 1; + + + if(c.length-1-stoppC <=0){ + break; + } + else if(c.length-1-stoppC <= 10){ + stoppC = c.length-1; + } + else{ + stoppC += cut; + } + } + + System.out.println(newLine); + + + + }