예제 #1
0
 private void setUpClouds() {
   Random rnd = new Random();
   //
   for (int i = 0; i < 8; i++) {
     //
     float rndSizeRatio = rnd.nextInt(80) + 20;
     //
     SmartActor currentCloud =
         new SmartActor(231 * rndSizeRatio / 100, 128 * rndSizeRatio / 100, rnd, true);
     //
     currentCloud.setTextureRegion(Assets.img_obj_cloud, true);
     currentCloud.setPosition(-200, gameManager.getStage().getHeight() / 2);
     //
     float posY =
         rnd.nextInt((int) gameManager.getStage().getHeight())
             + gameManager.getStage().getHeight() / 3;
     //
     currentCloud.startActionMoveSideToSideFreely(
         15, -200, (int) gameManager.getStage().getWidth() + 200, (int) posY, 15f);
     //
     addActor(currentCloud);
   }
 }
예제 #2
0
 private void setUpBottomSoils() {
   float worldWidth = gameManager.getStage().getWidth();
   float soilWidth = 300f;
   float soilHeight = 100f;
   //
   int numberOfSoils = (int) ((worldWidth / (soilWidth * AppSettings.getWorldSizeRatio())) + 1);
   //
   for (int i = 0; i < numberOfSoils; i++) {
     EmptyActorLight currentSoil = new EmptyActorLight(soilWidth, soilHeight, true);
     //
     currentSoil.setTextureRegion(Assets.img_obj_soil_1_, true);
     float posX = (i * currentSoil.getWidth()) - (4 * AppSettings.getWorldSizeRatio());
     currentSoil.setPosition(posX, 0);
     //
     addActor(currentSoil);
   }
 }