Browse Source

Continuation of adding ghost spawns

remotes/origin/ghosts
fdai7753 11 months ago
parent
commit
3b4a3f89c4
  1. 47
      src/main/java/pacmanGame/Map.java

47
src/main/java/pacmanGame/Map.java

@ -52,6 +52,8 @@ public class Map {
for(int i = 0; i < 10; i++) {
this.put(i+"", "empty");
}
this.put("0", "empty");
}};
public GameManager gameManager;
@ -72,31 +74,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);
//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);
if(cellChar == playerSpawnChar) {
playerSpawn = cellPos.Clone();
}
}
}
}
public Cell GetCell(Vector2 pos) {

|||||||
100:0
Loading…
Cancel
Save