use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.
the class TransitionConfigTest method testExportsImports.
/**
* Test exports and imports.
*
* @throws IOException If error.
*/
@Test
public void testExportsImports() throws IOException {
final MapTile map = UtilMap.createMap(7);
UtilMap.fill(map, UtilMap.TILE_WATER);
UtilMap.fill(map, UtilMap.TILE_WATER, UtilMap.TILE_TRANSITION, 3);
final MapTile map2 = UtilMap.createMap(7);
UtilMap.fill(map, UtilMap.TILE_WATER);
UtilMap.fill(map, UtilMap.TILE_GROUND, UtilMap.TILE_TRANSITION, 3);
final MapTile map3 = new MapTileGame();
map3.addFeature(new MapTileGroupModel());
map3.create(1, 1, 3, 3);
final TransitionsExtractor extractor = new TransitionsExtractorImpl();
final Map<Transition, Collection<TileRef>> transitions = extractor.getTransitions(Arrays.asList(map, map2, map3));
final Media media = Medias.create("transition.xml");
TransitionsConfig.exports(media, transitions);
Assert.assertEquals(transitions, TransitionsConfig.imports(media));
Assert.assertTrue(media.getFile().delete());
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.
the class Scene method load.
@Override
public void load() {
final MapTileGame map = services.create(MapTileGame.class);
map.create(Medias.create("level.png"));
final Camera camera = services.create(Camera.class);
camera.setIntervals(16, 0);
camera.setView(0, 0, getWidth(), getHeight(), getHeight());
camera.setLimits(map);
handler.add(camera);
final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
final MapTileCollision mapCollision = map.addFeatureAndGet(new MapTileCollisionModel());
mapCollisionRenderer = map.addFeatureAndGet(new MapTileCollisionRendererModel());
handler.add(map);
mapGroup.loadGroups(Medias.create("groups.xml"));
mapCollision.loadCollisions(Medias.create("formulas.xml"), Medias.create("collisions.xml"));
mapCollisionRenderer.createCollisionDraw();
final MapTileViewer mapViewer = map.addFeatureAndGet(new MapTileViewerModel(services));
mapViewer.addRenderer(mapCollisionRenderer);
mapViewer.prepare(map);
final Factory factory = services.create(Factory.class);
final Mario mario = factory.create(Mario.MEDIA);
mario.getFeature(Transformable.class).teleport(400, 31);
handler.add(mario);
final CameraTracker tracker = new CameraTracker(services);
tracker.track(mario);
handler.add(tracker);
clear.start();
tick.start();
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.
the class Scene method load.
@Override
public void load() {
map.create(Medias.create("forest.png"));
mapViewer.prepare(map);
final Media media = Medias.create("transitions.xml");
TransitionsConfig.exports(media, Arrays.asList(Medias.create("forest.png")), Medias.create("sheets.xml"), Medias.create("groups.xml"));
map.addFeatureAndGet(new MapTileGroupModel()).loadGroups(Medias.create("groups.xml"));
map.addFeatureAndGet(new MapTileTransitionModel()).loadTransitions(Medias.create("transitions.xml"));
map.addFeatureAndGet(new MapTileCircuitModel()).loadCircuits(Medias.create("circuits.xml"));
UtilFile.deleteFile(media.getFile());
camera.setView(0, 0, 1024, 768, getHeight());
camera.setLimits(map);
parameters.add(new PrefMapSize(16, 16, 64, 48)).add(new PrefMapFill(0)).add(new PrefMapRegion(12, new TileArea(0, 0, 8, 48), 4, 60)).add(new PrefMapRegion(12, new TileArea(56, 0, 64, 48), 4, 60)).add(new PrefMapRegion(12, new TileArea(0, 0, 64, 8), 4, 60)).add(new PrefMapRegion(12, new TileArea(0, 40, 64, 48), 4, 60)).add(new PrefMapRegion(29, new TileArea(12, 12, 56, 42), 2, 250)).add(new PrefMapRegion(12, new TileArea(24, 24, 40, 40), 2, 80)).add(new PrefMapRegion(0, new TileArea(4, 4, 60, 40), 1, 100));
tickGen.start();
tick.start();
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.
the class CollisionGroupConfigTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
final MapTileGame map = new MapTileGame();
map.addFeature(new MapTileGroupModel());
mapCollision = new MapTileCollisionModel();
mapCollision.prepare(map);
}
use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel in project lionengine by b3dgs.
the class MapTileCollisionModelTest method prepare.
/**
* Prepare test.
*/
@BeforeEach
public void prepare() {
map.addFeature(new MapTileGroupModel());
map.create(1, 1, 3, 3);
UtilMap.setGroups(map);
UtilMap.fill(map, UtilMap.TILE_GROUND);
mapCollision = map.addFeatureAndGet(new MapTileCollisionModel());
mapCollision.prepare(map);
formulasConfig = UtilConfig.createFormulaConfig(formulaV, formulaH);
groupsConfig = UtilConfig.createGroupsConfig(group);
mapCollision.loadCollisions(formulasConfig, groupsConfig);
transformable = createObject();
}
Aggregations