use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup in project lionengine by b3dgs.
the class TransitionsExtractorImpl method getTransitions.
/*
* TransitionsExtractor
*/
@Override
public Map<Transition, Collection<Integer>> getTransitions(Collection<Media> levels, Media sheetsConfig, Media groupsConfig) {
final Collection<MapTile> mapsSet = new HashSet<>(levels.size());
for (final Media level : levels) {
final MapTileGame map = new MapTileGame();
map.create(level, sheetsConfig);
final MapTileGroup mapGroup = new MapTileGroupModel();
mapGroup.loadGroups(groupsConfig);
map.addFeature(mapGroup);
mapsSet.add(map);
}
return getTransitions(mapsSet);
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup in project lionengine by b3dgs.
the class CircuitsExtractorImpl method getCircuits.
/*
* CircuitsExtractor
*/
@Override
public Map<Circuit, Collection<Integer>> getCircuits(Collection<Media> levels, Media sheetsConfig, Media groupsConfig) {
final Collection<MapTile> mapsSet = new HashSet<>(levels.size());
for (final Media level : levels) {
final MapTileGame map = new MapTileGame();
map.create(level, sheetsConfig);
final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
final MapTileTransition mapTransition = map.addFeatureAndGet(new MapTileTransitionModel());
mapGroup.loadGroups(groupsConfig);
mapTransition.loadTransitions(levels, sheetsConfig, groupsConfig);
mapsSet.add(map);
}
return getCircuits(mapsSet);
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup in project lionengine by b3dgs.
the class CircuitsExtractorImpl method checkTransitionGroups.
/**
* Check transitions groups, and create compatible circuit on the fly.
*
* @param circuits The circuits collection.
* @param circuit The circuit found.
* @param map The map reference.
* @param number The tile number to add.
*/
private static void checkTransitionGroups(Map<Circuit, Collection<Integer>> circuits, Circuit circuit, MapTile map, Integer number) {
final MapTileGroup mapGroup = map.getFeature(MapTileGroup.class);
final MapTileTransition mapTransition = map.getFeature(MapTileTransition.class);
final String group = mapGroup.getGroup(number);
for (final String groupTransition : mapGroup.getGroups()) {
if (mapTransition.getTransitives(group, groupTransition).size() == 1) {
final Circuit transitiveCircuit = new Circuit(circuit.getType(), group, groupTransition);
getTiles(circuits, transitiveCircuit).add(number);
}
}
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup in project lionengine by b3dgs.
the class MapGeneratorImpl method generateMap.
/*
* MapGenerator
*/
@Override
public MapTile generateMap(GeneratorParameter parameters, Collection<Media> levels, Media sheetsConfig, Media groupsConfig) {
final MapTileGame map = new MapTileGame();
map.loadSheets(sheetsConfig);
final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
final MapTileTransition mapTransition = map.addFeatureAndGet(new MapTileTransitionModel());
final MapTileCircuit mapCircuit = map.addFeatureAndGet(new MapTileCircuitModel());
mapGroup.loadGroups(groupsConfig);
mapTransition.loadTransitions(levels, sheetsConfig, groupsConfig);
mapCircuit.loadCircuits(levels, sheetsConfig, groupsConfig);
parameters.apply(map);
return map;
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup in project lionengine by b3dgs.
the class Scene method load.
@Override
public void load() {
map.create(Medias.create("forest.png"));
final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
final MapTilePath mapPath = map.addFeatureAndGet(new MapTilePathModel());
camera.setView(VIEW_X, VIEW_Y, getWidth() - VIEW_X, getHeight() - VIEW_Y, getHeight());
camera.setLimits(map);
camera.setLocation(160, 96);
map.addFeature(new MapTileViewerModel(services));
handler.add(map);
mapGroup.loadGroups(Medias.create("groups.xml"));
mapPath.loadPathfinding(Medias.create("pathfinding.xml"));
cursor.addImage(0, Medias.create("cursor.png"));
cursor.addImage(1, Medias.create("cursor_order.png"));
cursor.load();
cursor.setGrid(map.getTileWidth(), map.getTileHeight());
cursor.setSync(mouse);
cursor.setViewer(camera);
final Factory factory = services.create(Factory.class);
final Media media = Medias.create("Hud.xml");
final Hud hud = factory.create(media);
handler.add(hud);
final Selector selector = services.get(Selector.class);
selector.addFeatureAndGet(new LayerableModel(4));
selector.setClickableArea(camera);
selector.setSelectionColor(ColorRgba.GREEN);
selector.setClickSelection(MouseAwt.LEFT);
final Featurable peon = factory.create(Medias.create("Peon.xml"));
peon.getFeature(Pathfindable.class).setLocation(20, 10);
handler.add(peon);
transformable = peon.getFeature(Transformable.class);
tick.start();
}
Aggregations