Skip to content

Commit

Permalink
FusionRoom
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBeauchet committed Feb 27, 2021
1 parent 56add99 commit fa2ee79
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 174 deletions.
11 changes: 7 additions & 4 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ public static void main(String[] args) {
//myMap.upgradeCellsWithEntitys();
//System.out.println(myMap.cheminFind(myMap.getRooms().get(0).getDoors().get(0),myMap.getRooms().get(1).getDoors().get(0)));
//myMap.setPath();
Procedure.setRamdomRooms(myMap);
Model.Procedure.setRamdomMob(myMap);
Procedure.setRandomRooms(myMap);
Model.Procedure.setRandomMob(myMap);

//System.out.println(Procedure.getRandomRoom());
myMap.FustionRoom();
//myMap.ligne(new Position(10,5),new Position(30,30));
//myMap.ligneV2(new Position(10,5),new Position(30,30));

new Affichage(myMap);
myMap.RoomFusion();
new Affichage(myMap);
}
}
34 changes: 4 additions & 30 deletions src/main/java/Model/BasicPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,22 @@

public class BasicPlayer extends Entity {

private Map CurrentMap;

public BasicPlayer(Position position, Map map) {
super(position, map);
this.CurrentMap = map;
public BasicPlayer(Position position) {
super(position);
}

/*TODO deplacer tout ça
private boolean checkIfNewPositionAccessible(Position targetPosition) {
return getCurrentMap().Cells.get(targetPosition.getY()).get(targetPosition.getX()).isAccesible();
}
public void move(Position newPosition) {
if(checkIfNewPositionAccessible(newPosition))
setPosition(newPosition);
}
}*/

@Override
public String toString() {
return "\u001B[32m@";
}

public void move(int targetX, int targetY) {
move(new Position(targetX, targetY));
}

public void moveLeft() {
move(new Position(getPositionX() - 1, getPositionY()));
}

public void moveRight() {
move(new Position(getPositionX() + 1, getPositionY()));
}

public void moveUp() {
move(new Position(getPositionX(), getPositionY() - 1));
}

public void moveDown() {
move(new Position(getPositionX(), getPositionY() + 1));
}

public Map getCurrentMap() {
return CurrentMap;
}
}
4 changes: 2 additions & 2 deletions src/main/java/Model/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class Cell{
public enum CellType {
BORDER, NORMAL, DOOR, PATH, VOID, ANGLE, ;
BORDER, NORMAL, DOOR, PATH, VOID, ;
}
private final boolean isAccesible;
private final CellType type;
Expand Down Expand Up @@ -43,7 +43,7 @@ public String toString() {
case PATH -> {
return "\u001B[34m*";
}
case ANGLE, BORDER -> {
case BORDER -> {
return "\u001B[31m*";
}
case DOOR -> {
Expand Down
26 changes: 21 additions & 5 deletions src/main/java/Model/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
public abstract class Entity {

protected Position Position;
protected Map CurrentMap;

public Entity(Position position, Map currentMap) {
public Entity(Position position) {
this.Position = position;
this.CurrentMap = currentMap;
}

public Position getPosition() {
Expand All @@ -18,8 +16,6 @@ protected void setPosition(Position position) {
this.Position = position;
}



/* Pour que ce soit moins chiant */
public int getPositionX() {
return Position.getX();
Expand All @@ -36,4 +32,24 @@ protected void setPositionX(int x) {
protected void setPositionY(int y) {
setPosition(new Position(getPosition().getX(), y));
}

public void move(Position pos) {
move(new Position(pos.getX(), pos.getY()));
}

public void moveLeft() {
move(new Position(getPositionX() - 1, getPositionY()));
}

public void moveRight() {
move(new Position(getPositionX() + 1, getPositionY()));
}

public void moveUp() {
move(new Position(getPositionX(), getPositionY() - 1));
}

public void moveDown() {
move(new Position(getPositionX(), getPositionY() + 1));
}
}
Loading

0 comments on commit fa2ee79

Please sign in to comment.