From 79178886b68a43c146ceea03bc9ff30ffc5ced62 Mon Sep 17 00:00:00 2001 From: guezoloic Date: Thu, 23 May 2024 20:30:40 +0200 Subject: [PATCH] =?UTF-8?q?corrections=20et=20temps=20allong=C3=A9=20pour?= =?UTF-8?q?=20les=20requetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Main.java | 4 ++-- src/connexion/Channel.java | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Main.java b/src/Main.java index fbb1547..6910aee 100644 --- a/src/Main.java +++ b/src/Main.java @@ -6,7 +6,7 @@ import personnages.*; import types.Item; public class Main { - public static void main(String[] args) throws InterruptedException { + public static void main(String[] args) { Personnage.n = 2; Map map = new Map(20, 20); @@ -19,6 +19,6 @@ public class Main { // map.addObjects(Item.FRAISE, 0, 0); // map.addObjectsRandomize(new Item[] {Item.FRAISE}, 1); - new Terminal(map, personnages).run(new String(), new String()); + new Terminal(map, personnages).run("channel129", "channel128"); } } diff --git a/src/connexion/Channel.java b/src/connexion/Channel.java index ca43073..b4a639f 100644 --- a/src/connexion/Channel.java +++ b/src/connexion/Channel.java @@ -88,7 +88,12 @@ public class Channel extends Personnage { Mouvement mouvement; System.out.println("Attente de l'autre joueur."); - while ((mouvement = conversionMouvement(recupererMessage())) == null) reseau.reconnexion(this.channel); + while ((mouvement = conversionMouvement(recupererMessage())) == null) { + reseau.reconnexion(this.channel); + try { Thread.sleep(500); + } catch (InterruptedException e) { e.printStackTrace(); } + } + this.moveSnake(mouvement); int[] coordinate=this.getHeadCoordinate();