Search in sources :

Example 6 with MapTileGame

use of com.b3dgs.lionengine.game.feature.tile.map.MapTileGame 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);
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with MapTileGame

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

the class CollisionCategoryConfigTest method prepare.

/**
 * Prepare test.
 */
@BeforeEach
public void prepare() {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTileGroupModel());
    mapCollision = new MapTileCollisionModel();
    mapCollision.prepare(map);
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with MapTileGame

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

the class UtilMapTilePersister method createMap.

/**
 * Create a test map.
 *
 * @return The created test map.
 */
public static MapTile createMap() {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTilePersisterModel());
    map.create(16, 32, 3, 3);
    map.loadSheets(new ArrayList<SpriteTiled>());
    for (int tx = 0; tx < map.getInTileWidth(); tx++) {
        for (int ty = 1; ty < map.getInTileHeight(); ty++) {
            map.setTile(tx, ty, tx * ty);
        }
    }
    return map;
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) SpriteTiled(com.b3dgs.lionengine.graphic.drawable.SpriteTiled)

Example 9 with MapTileGame

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

the class UtilMapTilePersister method loadMap.

/**
 * Load map from file.
 *
 * @param level The level media.
 * @return The loaded map.
 * @throws IOException If error.
 */
public static MapTileGame loadMap(Media level) throws IOException {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTilePersisterModel());
    try (FileReading input = new FileReading(level)) {
        map.getFeature(MapTilePersister.class).load(input);
    }
    return map;
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) FileReading(com.b3dgs.lionengine.io.FileReading)

Example 10 with MapTileGame

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

the class AstarTest method testCreatePathFinder.

/**
 * Test the create path finder.
 */
@Test
void testCreatePathFinder() {
    final MapTileGame map = new MapTileGame();
    map.addFeature(new MapTileGroupModel());
    map.addFeature(new MapTilePathModel());
    assertNotNull(Astar.createPathFinder(map, 1, new HeuristicClosest()));
}
Also used : MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) Test(org.junit.jupiter.api.Test)

Aggregations

MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)27 Media (com.b3dgs.lionengine.Media)11 MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)11 MapTile (com.b3dgs.lionengine.game.feature.tile.map.MapTile)10 Test (org.junit.jupiter.api.Test)10 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Featurable (com.b3dgs.lionengine.game.feature.Featurable)4 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)4 TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)4 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)4 MapTileTransition (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransition)4 FileReading (com.b3dgs.lionengine.io.FileReading)4 Collection (java.util.Collection)4 Camera (com.b3dgs.lionengine.game.feature.Camera)3 FileWriting (com.b3dgs.lionengine.io.FileWriting)3 ViewerMock (com.b3dgs.lionengine.ViewerMock)2 Factory (com.b3dgs.lionengine.game.feature.Factory)2 Identifiable (com.b3dgs.lionengine.game.feature.Identifiable)2 Services (com.b3dgs.lionengine.game.feature.Services)2 MapTileTransitionModel (com.b3dgs.lionengine.game.feature.tile.map.transition.MapTileTransitionModel)2