diff --git a/src/main/Main.java b/src/main/Main.java index 7555b60cecadd77cb72dc2a3fa53476b1e2fa317..94ca0e44de8c48b8cb827533bc518d607d2953fb 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -17,36 +17,24 @@ public class Main { }*/ Plateau plateau = new Plateau(); -<<<<<<< HEAD int x = 11; int y = 10; -======= - int x = 11; - int y = 10; ->>>>>>> master plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner)); Affichage.affichage(plateau); + while(y<30) { winner.getArmee().get(0).move(deplacement()); System.out.println('\n'); -<<<<<<< HEAD winner.getArmee().get(0).teleporte(); -======= ->>>>>>> master Affichage.affichage(plateau); + } Menu(); -<<<<<<< HEAD plateau.getCase(12, 0); Affichage.affichage(plateau); //Menu(); - -======= - plateau.getCase(12, 0); - Affichage.affichage(plateau); ->>>>>>> master } public static void Menu () { diff --git a/src/units/Unite.java b/src/units/Unite.java index 8698a511d4e9c8560b2be924a1bbf01b88157417..10b849ecfd2a1c5f91939f53d1359335e2b5677e 100644 --- a/src/units/Unite.java +++ b/src/units/Unite.java @@ -1,8 +1,10 @@ package units; +import java.util.Random; + import items.Items; +import main.Affichage; import main.Case; -import main.Direction; import main.Event; import main.Joueur; import main.Plateau; @@ -31,6 +33,7 @@ public abstract class Unite { this.x = x; this.y = y; this.joueur = joueur; + this.joueur.ajoutUnit(this); this.item = null; this.vision = vision; } @@ -115,17 +118,12 @@ public abstract class Unite { if(x>=0 && x<plateau.getPlateau().length*plateau.getRegion(0, 0).region.length && y>=0 && y<plateau.getPlateau().length*plateau.getRegion(0, 0).region.length ) { this.plateau.getCase(x, y).setUnite(this); this.plateau.getCase(x, y).setType(Type.UNITE); + return true; } return false; } //à voir le type -<<<<<<< HEAD - public boolean move(Direction d) { - if(d == Direction.BAS) { - if (updatePosition(x+1,y)) { - this.plateau.getCase(x, y).setUnite(null); -======= public boolean move(char c) { /*if(c=='s' && updatePosition(x+1,y))*/ @@ -137,43 +135,33 @@ public abstract class Unite { this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setType(Type.GRASS); this.x+=1; ->>>>>>> master updateDecouverte(this.plateau.getCase(x+1, y), this.vision); return true; } } - else if(d == Direction.DROITE) { + else if(c == 'd') { if (updatePosition(x,y+1)) { this.plateau.getCase(x, y).setUnite(null); -<<<<<<< HEAD -======= this.plateau.getCase(x, y).setType(Type.GRASS); this.y+=1; ->>>>>>> master updateDecouverte(this.plateau.getCase(x, y+1), this.vision); return true; } } - else if(d == Direction.GAUCHE) { + else if(c == 'q') { if (updatePosition(x,y-1)) { this.plateau.getCase(x, y).setUnite(null); -<<<<<<< HEAD -======= this.plateau.getCase(x, y).setType(Type.GRASS); this.y-=1; ->>>>>>> master updateDecouverte(this.plateau.getCase(x, y-1), this.vision); return true; } } - else if(d == Direction.HAUT) { + else if(c == 'z') { if (updatePosition(x-1, y)) { this.plateau.getCase(x, y).setUnite(null); -<<<<<<< HEAD -======= this.plateau.getCase(x, y).setType(Type.GRASS); this.x-=1; ->>>>>>> master updateDecouverte(this.plateau.getCase(x-1, y), this.vision); return true; } @@ -181,8 +169,6 @@ public abstract class Unite { return false; } -<<<<<<< HEAD -======= public void teleporte() { Random alea = new Random(); int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length; @@ -199,7 +185,6 @@ public abstract class Unite { this.x=rd1; this.y=rd2; } ->>>>>>> master public void updateDecouverte (Case emplacement, int vision) { System.out.println("" + emplacement.getX() + ", " + emplacement.getY()); if (emplacement.getX()+1 < this.plateau.getLength()) { @@ -235,10 +220,6 @@ public abstract class Unite { } } } -<<<<<<< HEAD - -======= ->>>>>>> master public abstract String toString();