예제 #1
0
 def update(self, world):
     if not self.time:
         dirs = [[1, 0], [0, 1], [-1, 0], [0, -1]]
         shuffle(dirs)
         for dx, dy in dirs:
             if world.is_clear(self.x + dx, self.y + dy):
                 world.e.append(Entities.Ghost(self.x + dx, self.y + dy))
                 break
         self.time = randint(120, 360)
     else:
         self.time -= 1