コード例 #1
0
 def addObstacleAt(self, tile, obstacle_type):
     """Create an obstacle of obstacle_type at coordinates. Add a tile on top of it."""
     if tile.blocker:
         return
     obstacle = Obstacle(tile, gridhelper.getObjectZSize(obstacle_type),
                         self)
     self.assignID(obstacle)
     if self.visual:
         obstacle.createVisual()
     self.obstacles.append(obstacle)
     tile.visitors.append(obstacle)
     tile.blocker = True
     # add a tile on top of the obstacle
     coordinates2 = fife.ModelCoordinate(tile.coords)
     coordinates2.z += gridhelper.getObjectZSize(obstacle_type)
     new_tile = self.addTile(coordinates2, obstacle_type)
     obstacle.top_tile = new_tile