Browse Source

Merge branch 'ghosts'

remotes/origin/ghostsbehaviour
fdai7753 11 months ago
parent
commit
a9596d3721
  1. 63
      src/main/java/pacmanGame/Map.java

63
src/main/java/pacmanGame/Map.java

@ -21,8 +21,8 @@ public class Map {
"wwwwwww.wweeeeeeeeeeww.wwwwwww",
"wwwwwww.wwewwwwwwwweww.wwwwwww",
"wwwwwww.wweweeeeeeweww.wwwwwww",
"eeeeeee.eeewe0ee2eweee.eeeeeee",
"wwwwwww.wwewe1ee3eweww.wwwwwww",
"eeeeeee.eeew804629weee.eeeeeee",
"wwwwwww.wwewe1573eweww.wwwwwww",
"wwwwwww.wweweeeeeeweww.wwwwwww",
"wwwwwww.wwewwwwwwwweww.wwwwwww",
"wwwwwww.wweeeeeeeeeeww.wwwwwww",
@ -50,10 +50,16 @@ public class Map {
this.put("s", "empty");
this.put(".", "dot");
this.put("w", "wall");
for(int i = 0; i < 10; i++) {
this.put(i+"", "empty");
}
this.put("0", "empty");
this.put("1", "empty");
this.put("2", "empty");
this.put("3", "empty");
this.put("4", "empty");
this.put("5", "empty");
this.put("6", "empty");
this.put("7", "empty");
this.put("8", "empty");
this.put("9", "empty");
}};
@ -69,31 +75,28 @@ public class Map {
}
public void GenerateMap(String[] mapData) {
int sizeY = mapData.length;
int sizeX = mapData[0].length();
size = new Vector2(sizeX, sizeY);
cells = new Cell[size.x][size.y];
for(int x = 0; x < size.x; x++) {
for(int y = 0; y < size.y; y++) {
Vector2 cellPos = new Vector2(x,y);
int sizeY = mapData.length;
int sizeX = mapData[0].length();
char cellChar = mapData[size.y - 1 - y].charAt(x);
String cellType = mapTypes.get(String.valueOf(cellChar));
cells[x][y] = new Cell(cellPos, cellType, this);
//for(int i = 0; i < gameManager.ghosts.length; i++)
if(cellChar == playerSpawnChar) {
playerSpawn = cellPos.Clone();
}
}
}
size = new Vector2(sizeX, sizeY);
cells = new Cell[size.x][size.y];
for(int x = 0; x < size.x; x++) {
for(int y = 0; y < size.y; y++) {
Vector2 cellPos = new Vector2(x,y);
char cellChar = mapData[size.y - 1 - y].charAt(x);
String cellType = mapTypes.get(String.valueOf(cellChar));
cells[x][y] = new Cell(cellPos, cellType, this);
if(cellChar == playerSpawnChar) {
playerSpawn = cellPos.Clone();
}
}
}
}
public Cell GetCell(Vector2 pos) {

Loading…
Cancel
Save