Search in sources :

Example 1 with MapTileCollisionModel

use of com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollisionModel 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();
}
Also used : MapTileViewer(com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewer) MapTileGame(com.b3dgs.lionengine.game.feature.tile.map.MapTileGame) Factory(com.b3dgs.lionengine.game.feature.Factory) Transformable(com.b3dgs.lionengine.game.feature.Transformable) CameraTracker(com.b3dgs.lionengine.game.feature.CameraTracker) MapTileGroup(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup) MapTileCollision(com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollision) MapTileGroupModel(com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel) Camera(com.b3dgs.lionengine.game.feature.Camera) MapTileCollisionRendererModel(com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollisionRendererModel) MapTileViewerModel(com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewerModel) MapTileCollisionModel(com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollisionModel)

Aggregations

Camera (com.b3dgs.lionengine.game.feature.Camera)1 CameraTracker (com.b3dgs.lionengine.game.feature.CameraTracker)1 Factory (com.b3dgs.lionengine.game.feature.Factory)1 Transformable (com.b3dgs.lionengine.game.feature.Transformable)1 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)1 MapTileGroup (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroup)1 MapTileGroupModel (com.b3dgs.lionengine.game.feature.tile.map.MapTileGroupModel)1 MapTileCollision (com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollision)1 MapTileCollisionModel (com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollisionModel)1 MapTileCollisionRendererModel (com.b3dgs.lionengine.game.feature.tile.map.collision.MapTileCollisionRendererModel)1 MapTileViewer (com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewer)1 MapTileViewerModel (com.b3dgs.lionengine.game.feature.tile.map.viewer.MapTileViewerModel)1