public static Entity createEntity(PooledEngine engine, String name, float x, float y, Team team) { factoryParam.x = x; factoryParam.y = y; factoryParam.team = team; Entity entity = entityFactory.createEntity(name, factoryParam); SetupComponent setup = engine.createComponent(SetupComponent.class); setup.name = name; setup.team = team; entity.add(setup); engine.addEntity(entity); return entity; }
public static void generateWorldFromTileMapX( PooledEngine engine, PhysixSystem physixSystem, TiledMap map, boolean isClient) { factoryParam.isClient = isClient; if (GameConstants.LIGHTS || !isClient) { // Generate static world int tileWidth = map.getTileWidth(); int tileHeight = map.getTileHeight(); RectangleGenerator generator = new RectangleGenerator(); generator.generate( map, (Layer layer, TileInfo info) -> info.getBooleanProperty("solid", false), (Rectangle rect) -> addShape(physixSystem, rect, tileWidth, tileHeight)); if (GameConstants.LIGHTS) { createChainLights(map, engine); } if (!isClient) { createMapEntities(map, engine, physixSystem); } } }