mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-10-31 03:39:16 +00:00 
			
		
		
		
	a
This commit is contained in:
		| @@ -6,8 +6,6 @@ public class Enemy extends Character{ | |||||||
|  |  | ||||||
|     private String branch; |     private String branch; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     public Enemy(String name, int x, int y, String img, String map, int pv, String branch) { |     public Enemy(String name, int x, int y, String img, String map, int pv, String branch) { | ||||||
|         super(name, x, y, img, map); |         super(name, x, y, img, map); | ||||||
|         //generate his text |         //generate his text | ||||||
| @@ -19,8 +17,6 @@ public class Enemy extends Character{ | |||||||
|         this.branch = branch; |         this.branch = branch; | ||||||
|  |  | ||||||
|         this.pv = pv; |         this.pv = pv; | ||||||
|  |  | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setPosition(int x, int y, String map){ |     public void setPosition(int x, int y, String map){ | ||||||
|   | |||||||
| @@ -31,14 +31,12 @@ public class ScreenBattle extends RenderingScreen{ | |||||||
| 	public void onInit() { | 	public void onInit() { | ||||||
|         //display the question |         //display the question | ||||||
| 		generateFont("resources/font/Ubuntu-Regular.ttf", 30, Color.BLACK); | 		generateFont("resources/font/Ubuntu-Regular.ttf", 30, Color.BLACK); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
| 	public void onGraphicRender(GdxGraphics g) { | 	public void onGraphicRender(GdxGraphics g) { | ||||||
| 		g.clear(Color.BLACK); | 		g.clear(Color.BLACK); | ||||||
|  |  | ||||||
| 		displayDialog(g); | 		displayDialog(g); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,10 +14,63 @@ import java.util.RandomAccess; | |||||||
| class testYann{ | class testYann{ | ||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
|  |  | ||||||
|         FightData t = new FightData("enemi"); |  | ||||||
|         t.readFile(); |  | ||||||
|          |          | ||||||
|         System.out.println(t.getAttack(1).getAnswer(0).toString()); |         String line = "Je vais te manger tout cru, dans le creux de ma main et tu verra rien du tout."; | ||||||
|  |         String cutLine = ""; | ||||||
|  |         String newLine = ""; | ||||||
|  |  | ||||||
|  |         int cut = 25; | ||||||
|  |  | ||||||
|  |         int startC = 0; | ||||||
|  |         int stoppC = cut; | ||||||
|  |          | ||||||
|  |  | ||||||
|  |         char[] c = new char[line.length()]; | ||||||
|  |  | ||||||
|  |         for(int i=0; i<c.length;i++){ | ||||||
|  |             c[i] = line.charAt(i); | ||||||
|  |         } | ||||||
|  |         System.out.println("start\n"); | ||||||
|  |  | ||||||
|  |         while(true){ | ||||||
|  |  | ||||||
|  |             for(int i =stoppC; 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); | ||||||
|  |  | ||||||
|  |          | ||||||
|  |  | ||||||
|  |          | ||||||
|         |         | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user