Browse Source

added reference from Cell to Map

remotes/origin/menu
fdai7910 11 months ago
parent
commit
1e5d36d12c
  1. 4
      src/main/java/pacmanGame/Cell.java
  2. 2
      src/main/java/pacmanGame/Map.java

4
src/main/java/pacmanGame/Cell.java

@ -3,10 +3,12 @@ package pacmanGame;
public class Cell { public class Cell {
public Vector2 pos; public Vector2 pos;
public String type; public String type;
public final Map map;
public Cell(Vector2 pos, String type) {
public Cell(Vector2 pos, String type, Map map) {
this.pos = pos; this.pos = pos;
this.type = type; this.type = type;
this.map = map;
} }
public void triggerDot() { public void triggerDot() {

2
src/main/java/pacmanGame/Map.java

@ -76,7 +76,7 @@ public class Map {
String cellType = mapTypes.get(String.valueOf(cellChar)); String cellType = mapTypes.get(String.valueOf(cellChar));
cells[x][y] = new Cell(cellPos, cellType);
cells[x][y] = new Cell(cellPos, cellType, this);
if(cellChar == playerSpawnChar) { if(cellChar == playerSpawnChar) {
playerSpawn = cellPos.Clone(); playerSpawn = cellPos.Clone();

Loading…
Cancel
Save