Esempio n. 1
0
    def setup_tile_map(self):
        map_manager = self.gameworld.managers["map_manager"]

        tiles = []
        for i in range(100):
            tiles_i = []
            for j in range(100):
                if randint(0, 100) < 10:
                    tiles_i_j = [{'animation': 'tile_animation', 'layer': 0}]
                else:
                    tile_name = choice([
                        'orange-tile', 'purple-tile', 'green-tile', 'blue-tile'
                    ])
                    tiles_i_j = [{
                        'texture': tile_name,
                        'model': tile_name,
                        'layer': 0
                    }]
                tiles_i.append(tiles_i_j)
            tiles.append(tiles_i)

        map_manager.load_map('my_map', 100, 100, tiles)
        my_map = map_manager.maps['my_map']
        my_map.z_index_map = [0]
        my_map.tile_size = (64, 64)

        map_utils.init_entities_from_map(map_manager.maps['my_map'],
                                         self.gameworld.init_entity)
Esempio n. 2
0
    def setup_tile_map(self):
        # The map file to load
        # Change to hexagonal/isometric/isometric_staggered.tmx for other maps
        filename = get_asset_path('orthogonal.tmx','assets/maps')
        map_manager = self.gameworld.managers['map_manager']

        # Load TMX data and create a TileMap from it
        map_name = map_utils.parse_tmx(filename, self.gameworld)

        # Initialise each tile as an entity in the gameworld
        map_utils.init_entities_from_map(map_manager.maps[map_name],
                                       self.gameworld.init_entity)
Esempio n. 3
0
File: main.py Progetto: kivy/kivent
    def setup_tile_map(self):
        map_manager = self.gameworld.managers["map_manager"]

        tiles = []
        for i in range(100):
            tiles_i = []
            for j in range(100):
                if randint(0,100) < 10:
                    tiles_i_j = [{'animation':'tile_animation', 'layer':0}]
                else:
                    tile_name = choice(['orange-tile', 'purple-tile', 'green-tile', 'blue-tile'])
                    tiles_i_j = [{'texture':tile_name,
                                 'model':tile_name,
                                 'layer':0}]
                tiles_i.append(tiles_i_j)
            tiles.append(tiles_i)

        map_manager.load_map('my_map', 100, 100, tiles)
        my_map = map_manager.maps['my_map']
        my_map.z_index_map = [0]
        my_map.tile_size = (64, 64)

        map_utils.init_entities_from_map(map_manager.maps['my_map'], self.gameworld.init_entity)