コード例 #1
0
ファイル: ghosts.py プロジェクト: gvasquez11/pacman
    def check_directions(self, maze):
        self.directions_remain.clear()
        self.direction = "u"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "d":
                self.directions_remain.append("u")

        self.direction = "d"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "u":
                self.directions_remain.append("d")

        self.direction = "l"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "r":
                self.directions_remain.append("l")

        self.direction = "r"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "l":
                self.directions_remain.append("r")
コード例 #2
0
    def check_directions(self, maze):
        # check which directions are available to move
        self.avail.clear()
        self.direction = "u"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "d":
                self.avail.append("u")

        self.direction = "d"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "u":
                self.avail.append("d")

        self.direction = "l"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "r":
                self.avail.append("l")

        self.direction = "r"
        if gf.brick_collision(self, maze) is False:
            if self.move is not "l":
                self.avail.append("r")