use of com.b3dgs.lionengine.game.feature.tile.map.transition.circuit.generator.TileArea 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.transition.circuit.generator.TileArea in project lionengine by b3dgs.
the class MapTilePathModelTest method testGetFreeTileAroundNone.
/**
* Test the get free tile around with none found.
*/
@Test
void testGetFreeTileAroundNone() {
final Pathfindable pathfindable = createObject();
final TileArea tile = new TileArea(0, 0, 10, 10);
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
mapPath.addObjectId(x, y, Integer.valueOf(10));
}
}
assertNull(mapPath.getFreeTileAround(pathfindable, tile, map.getInTileRadius()));
}
use of com.b3dgs.lionengine.game.feature.tile.map.transition.circuit.generator.TileArea in project lionengine by b3dgs.
the class MapTilePathModelTest method testGetClosestTileAvailable.
/**
* Test the closest tile available.
*/
@Test
void testGetClosestTileAvailable() {
final Pathfindable pathfindable = createObject();
final TileArea tile = new TileArea(1, 2, 1, 1);
CoordTile coord = mapPath.getClosestAvailableTile(pathfindable, tile, 6);
assertEquals(1, coord.getX());
assertEquals(1, coord.getY());
coord = mapPath.getClosestAvailableTile(pathfindable, 1, 2, 2, 3, 6);
assertEquals(2, coord.getX());
assertEquals(3, coord.getY());
}
use of com.b3dgs.lionengine.game.feature.tile.map.transition.circuit.generator.TileArea in project lionengine by b3dgs.
the class MapTilePathModelTest method testGetFreeTileAround.
/**
* Test the get free tile around.
*/
@Test
void testGetFreeTileAround() {
final Pathfindable pathfindable = createObject();
final TileArea tile = new TileArea(3, 3, 1, 1);
CoordTile coord = mapPath.getFreeTileAround(pathfindable, tile, map.getInTileRadius());
assertEquals(2, coord.getX());
assertEquals(4, coord.getY());
mapPath.addObjectId(2, 4, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(2, coord.getX());
assertEquals(3, coord.getY());
mapPath.addObjectId(2, 3, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(2, coord.getX());
assertEquals(2, coord.getY());
mapPath.addObjectId(2, 2, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(3, coord.getX());
assertEquals(2, coord.getY());
mapPath.addObjectId(3, 2, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(4, coord.getX());
assertEquals(2, coord.getY());
mapPath.addObjectId(4, 2, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(4, coord.getX());
assertEquals(3, coord.getY());
mapPath.addObjectId(4, 3, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(4, coord.getX());
assertEquals(4, coord.getY());
mapPath.addObjectId(4, 4, Integer.valueOf(10));
coord = mapPath.getFreeTileAround(pathfindable, tile);
assertEquals(1, coord.getX());
assertEquals(5, coord.getY());
}
Aggregations