Пример #1
0
 private StarsSector declareSector(
     ZoomCamera camera,
     int count,
     Color blue,
     int x,
     int y,
     int width,
     int height,
     VertexBufferObjectManager mgr,
     ArrayList<TextureRegion> starRegions) {
   Entity sector = new Entity(x * width, y * height);
   for (int i = 0; i < count; i++) {
     int nextInt = Core.random.nextInt(starRegions.size());
     TextureRegion textureRegion = starRegions.get(nextInt);
     Star star2 = new Star(textureRegion, mgr);
     float _x = camera.getXMin() + Core.random.nextInt(width);
     float _y = camera.getYMin() + Core.random.nextInt(height);
     star2.setLocation(_x, _y);
     star2.setScale(1 - this.scrollFactor);
     star2.setColor(blue);
     sector.attachChild(star2);
   }
   if (Core.settings.starsLayerBorder) {
     Line top = new Line(0, 0, width, 0, mgr);
     Line bottom = new Line(0, height, width, height, mgr);
     Line left = new Line(0, 0, 0, height, mgr);
     Line right = new Line(width, 0, width, height, mgr);
     sector.attachChild(top);
     sector.attachChild(bottom);
     sector.attachChild(left);
     sector.attachChild(right);
   }
   return new StarsSector(sector, x, y, mgr);
 }