Search in sources :

Example 11 with MapTile

use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.

the class UtilMapTransition method createTransitions.

/**
 * Create map with transitive.
 *
 * @return The created configuration.
 */
public static Media createTransitions() {
    final MapTile map1 = UtilMap.createMap(16);
    UtilMap.fill(map1, TILE_GROUND);
    UtilMap.fill(map1, TILE_GROUND, TILE_TRANSITION, 6);
    UtilMap.fill(map1, TILE_WATER, TILE_TRANSITION, 3);
    UtilMap.fill(map1, TILE_TREE, TILE_TRANSITION2, 9);
    UtilMap.fill(map1, TILE_GROUND, TILE_TRANSITION, 13);
    map1.setTile(13, 13, TILE_ROAD);
    final MapTile map2 = UtilMap.createMap(10);
    UtilMap.fill(map2, TILE_WATER);
    UtilMap.fill(map2, TILE_GROUND, TILE_TRANSITION, 5);
    final MapTile map3 = UtilMap.createMap(10);
    UtilMap.fill(map3, TILE_TREE);
    UtilMap.fill(map3, TILE_GROUND, TILE_TRANSITION2, 5);
    final MapTile map4 = UtilMap.createMap(5);
    UtilMap.fill(map4, TILE_ROAD);
    map4.setTile(2, 2, TILE_GROUND);
    final Media config = Medias.create("transitives.xml");
    TransitionsConfig.exports(config, new TransitionsExtractorImpl().getTransitions(Arrays.asList(map1, map2, map3, map4)));
    return config;
}
Also used : Media(com.b3dgs.lionengine.Media) MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile)

Example 12 with MapTile

use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.

the class MapCircuitExtractorTest method testT3JRight.

/**
 * Check the three way junction right circuits.
 */
@Test
void testT3JRight() {
    final MapTile map = UtilMap.createMap(7);
    UtilMap.fill(map, TILE_GROUND);
    map.setTile(3, 2, TILE_ROAD);
    map.setTile(3, 3, TILE_ROAD);
    map.setTile(3, 4, TILE_ROAD);
    map.setTile(2, 3, TILE_ROAD);
    assertEquals(new Circuit(CircuitType.T3J_RIGHT, ROAD, GROUND), get(map, 3, 3));
}
Also used : MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Test(org.junit.jupiter.api.Test)

Example 13 with MapTile

use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.

the class MapCircuitExtractorTest method testAngles.

/**
 * Check the angles circuits.
 */
@Test
void testAngles() {
    final MapTile map = UtilMap.createMap(7);
    UtilMap.fill(map, TILE_GROUND);
    UtilMap.fill(map, TILE_ROAD, TILE_ROAD, 3);
    map.setTile(3, 3, TILE_GROUND);
    assertEquals(new Circuit(CircuitType.ANGLE_TOP_LEFT, ROAD, GROUND), get(map, 2, 4));
    assertEquals(new Circuit(CircuitType.ANGLE_TOP_RIGHT, ROAD, GROUND), get(map, 4, 4));
    assertEquals(new Circuit(CircuitType.ANGLE_BOTTOM_LEFT, ROAD, GROUND), get(map, 2, 2));
    assertEquals(new Circuit(CircuitType.ANGLE_BOTTOM_RIGHT, ROAD, GROUND), get(map, 4, 2));
}
Also used : MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Test(org.junit.jupiter.api.Test)

Example 14 with MapTile

use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.

the class MapCircuitExtractorTest method testT3JBottom.

/**
 * Check the three way junction bottom circuits.
 */
@Test
void testT3JBottom() {
    final MapTile map = UtilMap.createMap(7);
    UtilMap.fill(map, TILE_GROUND);
    map.setTile(2, 3, TILE_ROAD);
    map.setTile(3, 3, TILE_ROAD);
    map.setTile(4, 3, TILE_ROAD);
    map.setTile(3, 4, TILE_ROAD);
    assertEquals(new Circuit(CircuitType.T3J_BOTTOM, ROAD, GROUND), get(map, 3, 3));
}
Also used : MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Test(org.junit.jupiter.api.Test)

Example 15 with MapTile

use of com.b3dgs.lionengine.game.feature.tile.map.MapTile in project lionengine by b3dgs.

the class MapCircuitExtractorTest method testT3JLeft.

/**
 * Check the three way junction left circuits.
 */
@Test
void testT3JLeft() {
    final MapTile map = UtilMap.createMap(7);
    UtilMap.fill(map, TILE_GROUND);
    map.setTile(3, 2, TILE_ROAD);
    map.setTile(3, 3, TILE_ROAD);
    map.setTile(3, 4, TILE_ROAD);
    map.setTile(4, 3, TILE_ROAD);
    assertEquals(new Circuit(CircuitType.T3J_LEFT, ROAD, GROUND), get(map, 3, 3));
}
Also used : MapTile(com.b3dgs.lionengine.game.feature.tile.map.MapTile) Test(org.junit.jupiter.api.Test)

Aggregations

MapTile (com.b3dgs.lionengine.game.feature.tile.map.MapTile)58 Test (org.junit.jupiter.api.Test)34 Media (com.b3dgs.lionengine.Media)15 Tile (com.b3dgs.lionengine.game.feature.tile.Tile)11 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)10 Collection (java.util.Collection)9 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)8 MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)7 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)4 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)3 Setup (com.b3dgs.lionengine.game.feature.Setup)3 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)3 Featurable (com.b3dgs.lionengine.game.feature.Featurable)2 Transformable (com.b3dgs.lionengine.game.feature.Transformable)2 UtilTransformable (com.b3dgs.lionengine.game.feature.UtilTransformable)2 FileReading (com.b3dgs.lionengine.io.FileReading)2 FileWriting (com.b3dgs.lionengine.io.FileWriting)2 HashSet (java.util.HashSet)2