예제 #1
0
 def __init__(self, x, y, world):
     to = TileObject.TileObject()
     to.tile = self
     self.tileObjects = [to]
     self.x = x
     self.y = y
     self.world = world
예제 #2
0
    def step(self):
        if random.uniform(0, 1) < 0.00001:
            self.addTileObject(TileObject.Food())

        for tileObject in self.tileObjects:
            # Tile objects can move during their step, and then get stepped again in their
            # new tile. So we use a boolean flag to keep that from happening.
            if tileObject._stepping: continue
            tileObject._stepping = True
            tileObject.step()
예제 #3
0
def create_map(levelfolder, overview_dict=None):
    if not overview_dict:
        overview_filename = levelfolder + '/overview.txt'
        overview_dict = read_overview_file(overview_filename)
    tilefilename = levelfolder + '/TileData.png'
    mapfilename = levelfolder + '/MapSprite.png'
    weather = overview_dict['weather'].split(
        ',') if 'weather' in overview_dict else []
    currentMap = TileObject.MapObject(mapfilename, tilefilename, levelfolder,
                                      weather)
    return currentMap