mirror of
https://github.com/Cpt-Adok/SNAKE.git
synced 2026-01-25 07:34:05 +00:00
Rajout des commentaires
This commit is contained in:
@@ -12,14 +12,28 @@ public class Channel extends Personnage{
|
|||||||
reseau=new Reseau(channel);
|
reseau=new Reseau(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Méthode permettant l'envoi de message, grâce à celle de Réseau
|
||||||
|
* @param String contenant la direction voulue
|
||||||
|
**/
|
||||||
public void envoyerMessage(String s) {
|
public void envoyerMessage(String s) {
|
||||||
reseau.sendContent(s);
|
reseau.sendContent(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Méthode permettant la réception du dernier message envoyé, grâce à celle de Réseau
|
||||||
|
**/
|
||||||
public String recupererMessage() {
|
public String recupererMessage() {
|
||||||
return reseau.getLastedContent();
|
return reseau.getLastedContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Méthode permettant de convertir un String en Mouvement
|
||||||
|
* (Le String est celui récupéré dans le channel)
|
||||||
|
* @param String s
|
||||||
|
* @return Mouvement
|
||||||
|
*/
|
||||||
public Mouvements conversion(String s){
|
public Mouvements conversion(String s){
|
||||||
if (s.equals("U") || s.equals("u")){
|
if (s.equals("U") || s.equals("u")){
|
||||||
return Mouvements.HAUT;
|
return Mouvements.HAUT;
|
||||||
@@ -33,6 +47,14 @@ public class Channel extends Personnage{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cette méthode est commune à toutes les sous-classes de personnages
|
||||||
|
* Elle permet de jouer. Ici, on bouge le personnage en fonction du String
|
||||||
|
* reçu dans le Channel, converti en Mouvement.
|
||||||
|
* @param map
|
||||||
|
* @return boolean qui indique si le Personnage est vivant ou pas.
|
||||||
|
*/
|
||||||
// @Override
|
// @Override
|
||||||
public boolean round(Map map){
|
public boolean round(Map map){
|
||||||
int [] coordinate=this.getHeadCoordinate();
|
int [] coordinate=this.getHeadCoordinate();
|
||||||
|
|||||||
@@ -1,22 +1,27 @@
|
|||||||
|
import Connexion.Channel;
|
||||||
import environnements.Map;
|
import environnements.Map;
|
||||||
import game.Terminal;
|
import game.Terminal;
|
||||||
import object.Items;
|
import object.Items;
|
||||||
import personnages.Personnage;
|
import personnages.Personnage;
|
||||||
import personnages.Player;
|
import personnages.Player;
|
||||||
import tests.*;
|
//import tests.*;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Personnage.n = 2;
|
Personnage.n = 2;
|
||||||
|
|
||||||
Personnage[] personnages = new Personnage[] {
|
// Personnage[] personnages = new Personnage[] {
|
||||||
new Player(new int[] {0, 0}, "Philippe Etchebest"),
|
// new Player(new int[] {0, 0}, "Philippe Etchebest"),
|
||||||
new Player(new int[] {19, 19}, "Luke Skywalker")
|
// new Player(new int[] {19, 19}, "Luke Skywalker")
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map map = new Map(20, 20);
|
Map map = new Map(20, 20);
|
||||||
map.addObjectsRandomize(new Object[] {Items.FRAISE}, 2);
|
Channel chan=new Channel(map.getGrid(), "polic");
|
||||||
|
System.out.println(chan.round(map));
|
||||||
|
//map.addObjectsRandomize(new Object[] {Items.FRAISE}, 2);
|
||||||
|
|
||||||
new Terminal(map, personnages);
|
//new Terminal(map, personnages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user