当前位置: 首页>>代码示例>>Java>>正文


Java MapTileGame类代码示例

本文整理汇总了Java中com.b3dgs.lionengine.game.feature.tile.map.MapTileGame的典型用法代码示例。如果您正苦于以下问题:Java MapTileGame类的具体用法?Java MapTileGame怎么用?Java MapTileGame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapTileGame类属于com.b3dgs.lionengine.game.feature.tile.map包,在下文中一共展示了MapTileGame类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generate

import com.b3dgs.lionengine.game.feature.tile.map.MapTileGame; //导入依赖的package包/类
/**
 * Generate a map.
 * 
 * @param services The services reference.
 * @param theme The theme name.
 * @return The generated map.
 */
public static MapTile generate(Services services, String theme)
{
    final MapTile map = services.create(MapTileGame.class);
    map.addFeature(new LayerableModel(Constant.LAYER_MAP));
    map.loadSheets(Medias.create(Constant.FOLDER_TILE, theme, TileSheetsConfig.FILENAME));

    final java.util.Map<TileRef, Media> entities = getEntities(theme);
    final TileSetListener listener = createListener(entities, map, services);
    map.addListener(listener);

    final List<MapTile> maps = getMaps(theme, MAX_LEVELS);

    final Collection<MapTile> levels = new ArrayList<MapTile>();
    for (int i = 0; i < MAX_LEVELS; i++)
    {
        final MapTile current = maps.get(UtilRandom.getRandomInteger(maps.size() - 1));
        levels.add(current);
    }
    map.append(levels, 0, 1, 0, MAX_LEVEL_INTERVAL_HEIGHT_IN_TILE);

    map.removeListener(listener);
    entities.clear();

    return map;
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:33,代码来源:Map.java

示例2: getMaps

import com.b3dgs.lionengine.game.feature.tile.map.MapTileGame; //导入依赖的package包/类
/**
 * Get a list of maps.
 * 
 * @param theme The theme name.
 * @param count The file level count.
 * @return List of maps.
 */
private static List<MapTile> getMaps(String theme, int count)
{
    final List<MapTile> maps = new ArrayList<MapTile>();
    for (int i = 0; i <= count; i++)
    {
        final Media level = Medias.create(Constant.FOLDER_LEVELS, theme, i + ".map");
        final Services services = new Services();
        final MapTile map = services.create(MapTileGame.class);
        final MapTilePersister persister = map.addFeatureAndGet(new MapTilePersisterModel(services));
        try
        {
            final FileReading reading = new FileReading(level);
            persister.load(reading);
            reading.close();
        }
        catch (final IOException exception)
        {
            Verbose.exception(exception);
        }
        maps.add(map);
    }
    return maps;
}
 
开发者ID:b3dgs,项目名称:tyrian-remake,代码行数:31,代码来源:Map.java


注:本文中的com.b3dgs.lionengine.game.feature.tile.map.MapTileGame类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。