Skip to content
Snippets Groups Projects
Commit 182740c7 authored by Francois DEROUBAIX's avatar Francois DEROUBAIX
Browse files

update

parent 0ce40ed9
No related branches found
No related tags found
No related merge requests found
...@@ -17,36 +17,24 @@ public class Main { ...@@ -17,36 +17,24 @@ public class Main {
}*/ }*/
Plateau plateau = new Plateau(); Plateau plateau = new Plateau();
<<<<<<< HEAD
int x = 11; int x = 11;
int y = 10; int y = 10;
=======
int x = 11;
int y = 10;
>>>>>>> master
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner)); plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
Affichage.affichage(plateau); Affichage.affichage(plateau);
while(y<30) {
winner.getArmee().get(0).move(deplacement()); winner.getArmee().get(0).move(deplacement());
System.out.println('\n'); System.out.println('\n');
<<<<<<< HEAD
winner.getArmee().get(0).teleporte(); winner.getArmee().get(0).teleporte();
=======
>>>>>>> master
Affichage.affichage(plateau); Affichage.affichage(plateau);
}
Menu(); Menu();
<<<<<<< HEAD
plateau.getCase(12, 0); plateau.getCase(12, 0);
Affichage.affichage(plateau); Affichage.affichage(plateau);
//Menu(); //Menu();
=======
plateau.getCase(12, 0);
Affichage.affichage(plateau);
>>>>>>> master
} }
public static void Menu () { public static void Menu () {
......
package units; package units;
import java.util.Random;
import items.Items; import items.Items;
import main.Affichage;
import main.Case; import main.Case;
import main.Direction;
import main.Event; import main.Event;
import main.Joueur; import main.Joueur;
import main.Plateau; import main.Plateau;
...@@ -31,6 +33,7 @@ public abstract class Unite { ...@@ -31,6 +33,7 @@ public abstract class Unite {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.joueur = joueur; this.joueur = joueur;
this.joueur.ajoutUnit(this);
this.item = null; this.item = null;
this.vision = vision; this.vision = vision;
} }
...@@ -115,17 +118,12 @@ public abstract class Unite { ...@@ -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 ) { 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).setUnite(this);
this.plateau.getCase(x, y).setType(Type.UNITE); this.plateau.getCase(x, y).setType(Type.UNITE);
return true; return true;
} }
return false; return false;
} }
//à voir le type //à 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) { public boolean move(char c) {
/*if(c=='s' && updatePosition(x+1,y))*/ /*if(c=='s' && updatePosition(x+1,y))*/
...@@ -137,43 +135,33 @@ public abstract class Unite { ...@@ -137,43 +135,33 @@ public abstract class Unite {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.x+=1; this.x+=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x+1, y), this.vision); updateDecouverte(this.plateau.getCase(x+1, y), this.vision);
return true; return true;
} }
} }
else if(d == Direction.DROITE) { else if(c == 'd') {
if (updatePosition(x,y+1)) { if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.y+=1; this.y+=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x, y+1), this.vision); updateDecouverte(this.plateau.getCase(x, y+1), this.vision);
return true; return true;
} }
} }
else if(d == Direction.GAUCHE) { else if(c == 'q') {
if (updatePosition(x,y-1)) { if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.y-=1; this.y-=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x, y-1), this.vision); updateDecouverte(this.plateau.getCase(x, y-1), this.vision);
return true; return true;
} }
} }
else if(d == Direction.HAUT) { else if(c == 'z') {
if (updatePosition(x-1, y)) { if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null); this.plateau.getCase(x, y).setUnite(null);
<<<<<<< HEAD
=======
this.plateau.getCase(x, y).setType(Type.GRASS); this.plateau.getCase(x, y).setType(Type.GRASS);
this.x-=1; this.x-=1;
>>>>>>> master
updateDecouverte(this.plateau.getCase(x-1, y), this.vision); updateDecouverte(this.plateau.getCase(x-1, y), this.vision);
return true; return true;
} }
...@@ -181,8 +169,6 @@ public abstract class Unite { ...@@ -181,8 +169,6 @@ public abstract class Unite {
return false; return false;
} }
<<<<<<< HEAD
=======
public void teleporte() { public void teleporte() {
Random alea = new Random(); Random alea = new Random();
int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length; int longueur = plateau.getPlateau().length*plateau.getRegion(0, 0).region.length;
...@@ -199,7 +185,6 @@ public abstract class Unite { ...@@ -199,7 +185,6 @@ public abstract class Unite {
this.x=rd1; this.x=rd1;
this.y=rd2; this.y=rd2;
} }
>>>>>>> master
public void updateDecouverte (Case emplacement, int vision) { public void updateDecouverte (Case emplacement, int vision) {
System.out.println("" + emplacement.getX() + ", " + emplacement.getY()); System.out.println("" + emplacement.getX() + ", " + emplacement.getY());
if (emplacement.getX()+1 < this.plateau.getLength()) { if (emplacement.getX()+1 < this.plateau.getLength()) {
...@@ -235,10 +220,6 @@ public abstract class Unite { ...@@ -235,10 +220,6 @@ public abstract class Unite {
} }
} }
} }
<<<<<<< HEAD
=======
>>>>>>> master
public abstract String toString(); public abstract String toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment