use of com.b3dgs.lionengine.game.feature.collidable.selector.Selector in project lionengine by b3dgs.
the class Scene method load.
@Override
public void load() {
map.create(Medias.create("forest.png"));
final MapTileGroup mapGroup = map.addFeatureAndGet(new MapTileGroupModel());
final MapTilePath mapPath = map.addFeatureAndGet(new MapTilePathModel(services));
camera.setView(VIEW_X, VIEW_Y, getWidth() - VIEW_X, getHeight() - VIEW_Y, getHeight());
camera.setLimits(map);
camera.setLocation(160, 96);
map.addFeature(new MapTileViewerModel(services));
handler.add(map);
mapGroup.loadGroups(Medias.create("groups.xml"));
mapPath.loadPathfinding(Medias.create("pathfinding.xml"));
cursor.addImage(0, Medias.create("cursor.png"));
cursor.addImage(1, Medias.create("cursor_order.png"));
cursor.load();
cursor.setGrid(map.getTileWidth(), map.getTileHeight());
cursor.setInputDevice(mouse);
cursor.setViewer(camera);
final Factory factory = services.create(Factory.class);
final Hud hud = factory.create(Medias.create("Hud.xml"));
handler.add(hud);
final Selector selector = services.get(Selector.class);
selector.addFeature(new LayerableModel(4, 4));
selector.setClickableArea(camera);
selector.setSelectionColor(ColorRgba.GREEN);
selector.setClickSelection(MouseAwt.LEFT);
selector.getFeature(Collidable.class).addAccept(2);
final Featurable peon = factory.create(Medias.create("Peon.xml"));
peon.getFeature(Pathfindable.class).setLocation(20, 10);
handler.add(peon);
transformable = peon.getFeature(Transformable.class);
timing.start();
}
Aggregations