Skip to content
Snippets Groups Projects
Commit 4d42483c authored by Maxime Wallart's avatar Maxime Wallart :speech_balloon:
Browse files

update deplacements

parents c979be3b 378678ca
No related branches found
No related tags found
No related merge requests found
package main;
public enum Direction {
HAUT, GAUCHE, BAS, DROITE;
}
package main;
import java.util.Scanner;
import units.Paysant;
public class Main {
private static Joueur winner;
private static Joueur winner = new Joueur("Winner");
private int actionPoint;
public static void main(String[] args) {
......@@ -18,10 +20,13 @@ public class Main {
Plateau plateau = new Plateau();
int x = 11;
int y = 0;
int y = 10;
plateau.getCase(x, y).setUnite(new Paysant(x, y, plateau, winner));
//winner.ajoutUnit(plateau.getCase(x, y).getUnite());
Affichage.affichage(plateau);
plateau.getCase(x, y).getUnite().move(Direction.HAUT);
//plateau.getCase(x, y).getUnite().move(deplacement());
System.out.println(winner.getArmee().get(0));
winner.getArmee().get(0).move(deplacement());
System.out.println('\n');
Affichage.affichage(plateau);
<<<<<<< HEAD
......@@ -34,7 +39,21 @@ public class Main {
>>>>>>> 6e6d8e1d075a8855972540815248afce1757f9e0
}
<<<<<<< HEAD
public Joueur Game (Joueur[] joueurs) {
=======
public static char deplacement() {
Scanner sc = new Scanner(System.in);
System.out.println("Veuillez choisir une direction");
while (!sc.hasNext("[zqsd]")) {
System.out.println("Cette touche n'est pas acceptés, veuillez réessayer");
sc.next();
}
return sc.next().charAt(0);
}
private Joueur Game (Joueur[] joueurs) {
>>>>>>> Maxime
boolean gameEnd = false;
while(gameEnd){
for (Joueur currentPlayer : joueurs) {
......
......@@ -2,7 +2,6 @@ package units;
import items.Items;
import main.Case;
import main.Direction;
import main.Event;
import main.Joueur;
import main.Plateau;
......@@ -30,6 +29,7 @@ public abstract class Unite {
this.x = x;
this.y = y;
this.joueur = joueur;
this.joueur.ajoutUnit(this);
this.item = null;
}
......@@ -125,26 +125,26 @@ public abstract class Unite {
return false;
}
//à voir le type
public boolean move(Direction d) {
if(d == Direction.BAS) {
public boolean move(char c) {
if(c == 's') {
if (updatePosition(x+1,y)) {
this.plateau.getCase(x, y).setUnite(null);
return true;
}
}
else if(d == Direction.DROITE) {
else if(c == 'd') {
if (updatePosition(x,y+1)) {
this.plateau.getCase(x, y).setUnite(null);
return true;
}
}
else if(d == Direction.GAUCHE) {
else if(c == 'q') {
if (updatePosition(x,y-1)) {
this.plateau.getCase(x, y).setUnite(null);
return true;
}
}
else if(d == Direction.HAUT) {
else if(c == 'z') {
if (updatePosition(x-1, y)) {
this.plateau.getCase(x, y).setUnite(null);
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment