def parseField(self, screenRows): for y in range(self.field.height()): for x in range(self.field.width()): if Pacman.isPacman(screenRows[y][x]): self.pacman = Pacman(self, (x, y), screenRows[y][x]) self.pacman.useAnimation(self.animation) self.field.add((x, y), self.pacman) if Wall.isWall(screenRows[y][x]): wall = Wall((x, y), screenRows[y][x]) self.walls.append(wall) self.field.add((x, y), wall) if Wall.isGate(screenRows[y][x]): self.gate = wall if Pill.isPill(screenRows[y][x]): pill = Pill((x, y), screenRows[y][x]) self.pills.append(pill) self.field.add((x, y), pill) if Ghost.isGhost(screenRows[y][x]): ghost = Ghost(self, (x, y), screenRows[y][x]) self.ghosts.append(ghost) self.field.add((x, y), ghost)
def isGate(self, coordinates): return Wall.isGate(self.field.get(coordinates))