correction de probleme et ajout d'un quick multi

This commit is contained in:
2024-05-24 10:27:58 +02:00
parent 79178886b6
commit 94a3fbb26c
5 changed files with 79 additions and 17 deletions

View File

@@ -1,5 +1,3 @@
import connexion.Channel;
import connexion.Reseau;
import environnements.*;
import game.Terminal;
import personnages.*;
@@ -11,14 +9,27 @@ public class Main {
Map map = new Map(20, 20);
Personnage[] personnages = new Personnage[] {
new Player(new int[] {0, 0}, "Philippe Etchebest"),
};
// lancer en local
if (args.length < 2) {
Grid[][] grid = map.getGrid();
// map.addObjects(Item.FRAISE, 0, 0);
// map.addObjectsRandomize(new Item[] {Item.FRAISE}, 1);
Personnage[] personnages = new Personnage[] {
new Player(new int[] {0, 0}, "Philippe Etchebest"),
new Player(new int[] {grid[0].length - 1, grid.length - 1}, "Luke Skywalker")
};
new Terminal(map, personnages).run("channel129", "channel128");
map.addObjects(Item.FRAISE, 3, 5);
map.addObjectsRandomize(new Item[] {Item.FRAISE, Item.WALL}, 3);
new Terminal(map, personnages).run();
}
// lancer en ligne
else {
Personnage[] personnages = new Personnage[] {
new Player(new int[] {0, 0}, "Philippe Etchebest"),
};
new Terminal(map, personnages).run(args[0], args[1]);
}
}
}

View File

@@ -1,9 +1,6 @@
package connexion;
import java.util.Arrays;
import environnements.*;
import types.Item;
import types.Mouvement;
import personnages.Personnage;
@@ -12,12 +9,9 @@ public class Channel extends Personnage {
private static Reseau adversaire;
private String channel;
private Map map;
public Channel(Map map, String channel, String autreChannel) {
super(new int [] {map.getGrid()[0].length - 1, map.getGrid().length - 1});
this.map = map;
this.name = autreChannel;
this.channel = channel;