/** resets actor positions after eg. panning */
  private void resetPositions() {
    // reset positions
    Actor actor = getChildren().get(currentElement);
    actor.addAction(
        Actions.parallel(
            Actions.moveTo(0, 0, animationDuration, Interpolation.pow2In),
            Actions.fadeIn(animationDuration)));

    if (currentOffsetX <= 0 && (cycle || hasNextElement())) {
      final Actor next = setupNextElement();
      next.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));
    } else if ((cycle || hasLastElement())) {
      final Actor next = setupLastElement();
      next.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(-animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));
    }
  }
Exemple #2
0
  @Override
  public void onUse() {
    if (GemLord.getInstance().gameScreen.getBoard().getBoardState() != Board.BoardState.STATE_IDLE)
      return;
    if (!GemLord.getInstance().gameScreen.getBoard().isPlayerTurn()) return;

    if (currentCooldown <= 0) {
      GemLord.soundPlayer.playBow();
      int damage = random.nextInt(((35 - 20) + 1));
      damage += 20;

      Damage dmg = new Damage();
      dmg.damage = damage;
      GemLord.getInstance().gameScreen.getBoard().getEnemy().damage(dmg);
      addAction(Actions.sequence(Actions.scaleTo(2f, 2f, 0.15f), Actions.scaleTo(1f, 1f, 0.15f)));
      currentCooldown = cooldown;
      TextureAtlas atlas = GemLord.assets.get("data/textures/pack.atlas", TextureAtlas.class);
      Image projectile = new Image(atlas.findRegion("itemarrow"));
      projectile.setPosition(getX(), getY());

      float targetX = GemLord.getInstance().gameScreen.getBoard().getEnemy().getImage().getX();
      float targetY = GemLord.getInstance().gameScreen.getBoard().getEnemy().getImage().getY();

      projectile.addAction(
          Actions.sequence(
              Actions.moveTo(targetX, targetY, 0.25f),
              Actions.fadeOut(0.25f),
              Actions.removeActor()));

      GemLord.getInstance().gameScreen.getBoard().getEffectGroup().addActor(projectile);
    }
  }
 @Override
 public void show() {
   initSplashManager();
   splashImage.addAction(
       Actions.sequence(
           Actions.sequence(
               Actions.fadeIn(0.75f),
               Actions.delay(2.75f),
               Actions.fadeOut(0.75f),
               Actions.run(onFirstSplashFinishedRunnable))));
   splashStage.addActor(splashImage);
 }
Exemple #4
0
  @Override
  protected Label updateLabel(Player player, Type index, final String text) {
    super.updateLabel(player);
    final Map<Player, Table> labels = getLabelMap();
    final Label label = (Label) labels.get(player).getChildren().get(index.type);
    final EventListener first = label.getListeners().first();

    label.clearListeners();
    label.addListener(first);

    if (index == Type.PLAYER) label.addListener(getListener(player));

    final Runnable runnable =
        new Runnable() {
          @Override
          public void run() {
            label.setText(text);
          }
        };

    final SequenceAction sequence =
        Actions.sequence(
            Actions.fadeOut(getSpeed()), Actions.run(runnable), Actions.fadeIn(getSpeed()));
    label.addAction(sequence);

    return label;
  }
  /** cycles to the last element */
  public void last() {
    if (cycle || hasLastElement()) {
      final int nextElement = (currentElement - 1 + getChildren().size) % getChildren().size;
      final Actor next = setupLastElement();
      next.addAction(
          Actions.parallel(
              Actions.moveTo(0, 0, animationDuration, Interpolation.pow2In),
              Actions.fadeIn(animationDuration)));

      final Actor old = getChildren().get(currentElement);
      old.clearActions();
      old.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));

      currentElement = nextElement;

      fireElementChanged();
    } else {
      checkBeforeFirst();
    }
  }
Exemple #6
0
  /**
   * Generate new colors. This method is executed by the callback action when the player selects a
   * valid rectangle. The purpose of this method is to regenerate the board and apply any required
   * checks to make sure that the game doesn't enter in an infinite loop.
   *
   * @param bounds the bounds that have to be regenerated.
   */
  private void generate(Bounds bounds) {
    // Generate new balls;
    game.getState()
        .getBoard()
        .randomize(
            new Coordinate(bounds.minX, bounds.minY), new Coordinate(bounds.maxX, bounds.maxY));

    // Check the new board for valid combinations.
    CombinationFinder newFinder = CombinationFinder.create(game.getState().getBoard());
    if (newFinder.getPossibleBounds().size() == 1) {
      // Only one combination? This is trouble.
      Bounds newCombinationBounds = newFinder.getCombination();
      if (newCombinationBounds.equals(bounds)) {
        // Oh, oh, in the same spot! So, they must be of the same color.
        // Therefore, we need to randomize some balls to avoid enter
        // an infinite loop.
        timer.setRunning(false);
        board.setColoured(false);
        game.getState().resetBoard();
        board.addAction(
            Actions.sequence(
                board.shake(10, 5, 0.05f),
                Actions.run(
                    new Runnable() {
                      @Override
                      public void run() {
                        board.setColoured(true);
                        timer.setRunning(true);
                      }
                    })));
      }
    }
    board.addAction(board.showRegion(bounds));
  }
 public void swipeOut(boolean direction) {
   final Actor old = getChildren().get(currentElement);
   old.clearActions();
   if (direction) {
     old.addAction(
         Actions.sequence(
             Actions.parallel(
                 Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                 Actions.fadeOut(animationDuration)),
             Actions.visible(false)));
   } else {
     old.addAction(
         Actions.sequence(
             Actions.parallel(
                 Actions.moveTo(-animationXOffset, 0, animationDuration, Interpolation.pow2In),
                 Actions.fadeOut(animationDuration)),
             Actions.visible(false)));
   }
 }
 private void updateFreeze() {
   freezers = LevelData.freezers;
   freezes.setText(String.valueOf(freezers));
   imgFreeze.addAction(
       Actions.sequence(
           Actions.scaleTo(0f, 0f),
           Actions.alpha(1f),
           Actions.parallel(
               Actions.rotateBy(360f, 0.7f),
               Actions.scaleTo(1f, 1f, 0.5f),
               Actions.alpha(0f, 1.0f, Interpolation.circleIn))));
 }
 @Override
 public void run() {
   // TODO Auto-generated method stub
   splashImage = new Image(getImage("antlr"));
   splashImage.addAction(
       Actions.sequence(
           Actions.sequence(
               Actions.fadeIn(0.75f),
               Actions.delay(1.75f),
               Actions.fadeOut(0.75f),
               Actions.run(
                   new Runnable() {
                     @Override
                     public void run() {
                       // TODO Auto-generated method stub
                       dispose();
                       incodr_main.setScreen(incodr_main.menu);
                     }
                   }))));
   splashStage.addActor(splashImage);
 }
  public void moveToActive(float duration) {
    MenuElement menuElement = this.elements.get(this.order.get(this.active));
    Actor actor = menuElement.getElement();

    float offset = actor.getWidth() / 2f;

    this.group.clearActions();
    this.group.addAction(
        Actions.sequence(
            // Actions.moveToAligned((actor.getX() + offset) * -1f, 0f, Align.center, duration,
            // Interpolation.sine)
            Actions.moveTo((actor.getX() + offset) * -1f, 0f, duration)));
  }
 private void dropStar(Image img) {
   stars--;
   img.setDrawable(new TextureRegionDrawable(Assets.instance.gameElements.starOff));
   star.setPosition(img.getX() - 45, img.getY() - 50);
   star.addAction(
       Actions.sequence(
           Actions.scaleTo(0.3f, 0.3f),
           Actions.alpha(1f),
           Actions.parallel(
               Actions.rotateBy(210f, 0.9f),
               Actions.scaleTo(0.8f, 0.8f, 0.9f),
               Actions.moveTo(star.getX() - 45f, star.getY() - 210f, 1.2f),
               Actions.alpha(0f, 0.9f, Interpolation.circleIn))));
 }
Exemple #12
0
 @Override
 public void act(float delta) {
   super.act(delta);
   if (state == State.BUMP && bumpAnimation.isAnimationFinished(stateTime))
     addAction(
         Actions.sequence(
             Actions.fadeOut(0.1f),
             new Action() {
               @Override
               public boolean act(float delta) {
                 remove();
                 return true;
               }
             }));
 }
  // other overrides ----------------------------------------------------------------------------
  @Override
  public void show() {
    super.show();

    table.addAction(
        Actions.sequence(Actions.alpha(0), Actions.fadeIn(0.10f), Actions.delay(0.10f)));
    stage.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            if (time > 2f) {
              dispose();
              ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen());
            }
          }
        });
  }
Exemple #14
0
  public void setSelectedWidget(int index) {
    if (widgets.size > index) {
      Actor newBar = widgets.get(index);

      if (newBar != toShow) {
        Color color = colors.get(index);
        setColor(color == null ? style.color : color);

        for (Actor widget : widgets) {
          widget.clearActions();
        }

        Actor current = getActor();
        if (current != null) {
          current.setTouchable(Touchable.disabled);
        } else {
          current = toShow;
        }

        toShow = newBar;

        Actor toHide = current;
        toHide.setOrigin(Align.center);

        if (toShow.getScaleY() == 1) {
          toShow.setScaleY(0);
          toShow.setOriginY(toHide.getOriginY());
          toShow.getColor().a = 0;
        }

        float timeHide = ANIM_TIME * Math.abs(toHide.getScaleY());

        Action actionShow = Actions.run(actionAddActor);
        Action actionHide =
            Actions.parallel(
                Actions.scaleTo(1, 0, timeHide, Interpolation.sineOut), Actions.fadeOut(timeHide));

        if (newBar == current) {
          toHide.addAction(actionShow);
        } else {
          toHide.addAction(Actions.sequence(actionHide, actionShow));
        }
      }
    }
  }
Exemple #15
0
  /**
   * Create a countdown in the screen lasting for the amount of seconds given. When the countdown
   * reaches 0, the code provided in the runnable will be executed as a callback.
   *
   * @param seconds how many seconds should the countdown be displayed.
   */
  private void countdown(final int seconds, final Runnable after) {
    // Since this is a recursive function, avoid the case where you pass
    // a number of seconds that might trigger an infinite loop.
    if (seconds <= 0) {
      return;
    }

    // Create the label that will contain this number
    String number = Integer.toString(seconds);
    final Label label = new Label(number, game.getSkin(), "monospace");
    label.setFontScale(5f);
    label.setSize(150, 150);
    label.setAlignment(Align.center);
    label.setPosition(
        (getStage().getWidth() - label.getWidth()) / 2,
        (getStage().getHeight() - label.getHeight()) / 2);

    // Add the label to the stage and play a sound to notify the user.
    getStage().addActor(label);
    game.player.playSound(SoundCode.SELECT);

    label.addAction(
        Actions.sequence(
            Actions.parallel(Actions.moveBy(0, 80, 1f)),

            // After the animation, decide. If the countdown hasn't finished
            // yet, run another countdown with 1 second less.
            Actions.run(
                new Runnable() {
                  @Override
                  public void run() {
                    label.remove();
                    if (seconds > 1) {
                      countdown(seconds - 1, after);
                    } else {
                      after.run();
                    }
                  }
                })));
  }
 @Override
 public IFuture<Void> visualize(final TransformToObstacleResult result) {
   final Future<Void> future = new Future<Void>();
   WorldObjectView view =
       result.creature.world.getController(ViewController.class).getView(result.creature);
   final Tile obstacle = new Tile("obstacle/" + result.obstacle);
   visualizer.viewController.effectLayer.addActor(obstacle);
   obstacle.setPosition(
       result.creature.getX() * ViewController.CELL_SIZE,
       result.creature.getY() * ViewController.CELL_SIZE);
   obstacle.getColor().a = 0f;
   obstacle.addAction(Actions.alpha(1, 0.5f));
   view.addAction(
       Actions.delay(
           0.4f,
           Actions.run(
               new Runnable() {
                 @Override
                 public void run() {
                   if (result.ability.name.endsWith("petrification")) {
                     SoundManager.instance.playSound("ability-freeze-hit");
                   } else {
                     SoundManager.instance.playSound("transformation");
                   }
                 }
               })));
   view.addAction(
       Actions.sequence(
           Actions.alpha(0, 0.5f),
           Actions.run(
               new Runnable() {
                 @Override
                 public void run() {
                   obstacle.remove();
                   future.happen();
                 }
               })));
   return future;
 }
Exemple #17
0
  private void showPartialScore(int score, Bounds bounds, boolean special) {
    // Calculate the center of the region.
    BallActor bottomLeftBall = board.getBall(bounds.minX, bounds.minY);
    BallActor upperRightBall = board.getBall(bounds.maxX, bounds.maxY);

    float minX = bottomLeftBall.getX();
    float maxX = upperRightBall.getX() + upperRightBall.getWidth();
    float minY = bottomLeftBall.getY();
    float maxY = upperRightBall.getY() + upperRightBall.getHeight();
    float centerX = (minX + maxX) / 2;
    float centerY = (minY + maxY) / 2;

    Label label = new Label("+" + score, game.getSkin(), "monospace");
    label.setFontScale(5f);
    label.setSize(140, 70);
    label.setAlignment(Align.center);
    label.setPosition(centerX - label.getWidth() / 2, centerY - label.getHeight() / 2);
    label.addAction(Actions.sequence(Actions.moveBy(0, 80, 0.5f), Actions.removeActor()));
    getStage().addActor(label);

    if (special) {
      label.setColor(Color.CYAN);
    }
  }
 public void exit() {
   clearActions();
   addAction(Actions.sequence(Actions.moveTo(getX(), -200, .8f), Actions.removeActor()));
 }
Exemple #19
0
  public Beaver(World world, Island island) {
    this.island = island;
    float scale = 2.0f;
    float radius = 1.0f;
    BodyDef bd = new BodyDef();
    bd.type = BodyDef.BodyType.DynamicBody;

    Vector2 pos = island.physicsBody.getPosition();
    ang = island.physicsBody.getAngle();

    float islandW = island.getPhysicsWidth();
    float islandH = island.getPhysicsHeight();

    Vector2 off = new Vector2(islandW * MathUtils.random(0.3f, 0.6f), islandH);
    off.rotate(MathUtils.radiansToDegrees * ang);

    bd.position.set(new Vector2(pos.x + off.x, pos.y + off.y));
    bd.angle = ang;

    off.set(islandW * 0.075f, islandH);
    off.rotate(MathUtils.radiansToDegrees * ang);
    Vector2 rightEdge = new Vector2(pos.x + off.x, pos.y + off.y).scl(Mane.PTM_RATIO);
    off.set(islandW * 0.85f, islandH);
    off.rotate(MathUtils.radiansToDegrees * ang);
    Vector2 leftEdge = new Vector2(pos.x + off.x, pos.y + off.y).scl(Mane.PTM_RATIO);

    float speed = MathUtils.random(1.0f, 3.0f);
    addAction(
        Actions.delay(
            MathUtils.random(0.0f, 1.0f),
            Actions.forever(
                Actions.sequence(
                    Actions.moveTo(rightEdge.x, rightEdge.y, speed),
                    Actions.moveTo(leftEdge.x, leftEdge.y, speed)))));

    bd.linearDamping = 0.2f;

    Body body = world.createBody(bd);

    FixtureDef fd = new FixtureDef();

    fd.density = 1.0f;
    fd.filter.categoryBits = Collision.BEAVER;
    fd.filter.maskBits = Collision.SHARK;

    fd.restitution = 0.0f;
    fd.friction = 0.0f;
    fd.isSensor = true;

    CircleShape cs = new CircleShape();
    cs.setRadius(radius);
    cs.setPosition(new Vector2(radius, radius));

    fd.shape = cs;

    body.createFixture(fd);
    cs.dispose();
    super.initPhysicsBody(body);

    setSize(scale * Mane.PTM_RATIO, scale * Mane.PTM_RATIO);
    setOrigin(0.0f, 0.0f);
  }
Exemple #20
0
  @Override
  public void onSelectionSucceeded(final List<BallActor> selection) {
    // Extract the data from the selection.
    List<Ball> balls = new ArrayList<>();
    for (BallActor selectedBall : selection) balls.add(selectedBall.getBall());
    final Bounds bounds = Bounds.fromBallList(balls);

    // Change the colors of the selected region.
    board.addAction(
        Actions.sequence(
            board.hideRegion(bounds),
            Actions.run(
                new Runnable() {
                  @Override
                  public void run() {
                    for (BallActor selectedBall : selection) {
                      selectedBall.setColor(Color.WHITE);
                    }
                    generate(bounds);
                    // Reset the cheat
                    game.getState().setCheatSeen(false);
                    game.getState().setWiggledBounds(null);
                  }
                })));

    // Give some score to the user.
    ScoreCalculator calculator = new ScoreCalculator(game.getState().getBoard(), bounds);
    int givenScore = calculator.calculate();
    game.getState().addScore(givenScore);
    score.giveScore(givenScore);

    // Put information about this combination in the stats.
    int rows = bounds.maxY - bounds.minY + 1;
    int cols = bounds.maxX - bounds.minX + 1;
    String size = Math.max(rows, cols) + "x" + Math.min(rows, cols);
    game.statistics.getSizesData().incrementValue(size);

    BallColor color = board.getBall(bounds.minX, bounds.minY).getBall().getColor();
    game.statistics.getColorData().incrementValue(color.toString().toLowerCase());
    game.statistics.getTotalData().incrementValue("balls", rows * cols);
    game.statistics.getTotalData().incrementValue("combinations");

    // Now, display the score to the user. If the combination is a
    // PERFECT combination, just display PERFECT.
    int boardSize = game.getState().getBoard().getSize() - 1;
    if (bounds.equals(new Bounds(0, 0, boardSize, boardSize))) {
      // Give score
      Label label = new Label("PERFECT", game.getSkin(), "monospace");
      label.setX((getStage().getViewport().getWorldWidth() - label.getWidth()) / 2);
      label.setY((getStage().getViewport().getWorldHeight() - label.getHeight()) / 2);
      label.setFontScale(3);
      label.setAlignment(Align.center);
      label.addAction(Actions.sequence(Actions.moveBy(0, 80, 0.5f), Actions.removeActor()));
      getStage().addActor(label);
      game.player.playSound(SoundCode.PERFECT);

      // Give time
      float givenTime = Constants.SECONDS - timer.getSeconds();
      timer.giveTime(givenTime, 4f);
    } else {
      // Was special?
      boolean special = givenScore != rows * cols;
      // Give score
      showPartialScore(givenScore, bounds, special);
      game.player.playSound(SoundCode.SUCCESS);

      // Give time
      float givenTime = 4f;
      timer.giveTime(givenTime, 0.25f);
    }
  }
 public void death() {
   super.death();
   screen.getStage().addActor(new ExplosionMedium(this));
   addAction(
       Actions.sequence(Actions.delay(.5f), Actions.scaleTo(0f, 0f, 0f), Actions.removeActor()));
 }
  @Override
  public synchronized void run() {
    Texture rawImg = resources.get("images/bullet1.jpg", Texture.class);
    TextureRegion bimg;
    Enemy e;
    Bullet b;
    checkTime(1000);
    // first five
    e =
        PowerElf.newPowerElf(
            (World.CAMERA_WIDTH - Butterfly.WIDTH) / 2f - PowerElf.WIDTH,
            World.CAMERA_HEIGHT,
            resources,
            world,
            60);
    e.addAction(
        Actions.sequence(
            Actions.moveBy(0, -16f, 1), Actions.moveBy(0, 0, 3f), Actions.moveBy(0, 32f, 2)));
    bimg = new TextureRegion(rawImg, 32, 248, 8, 8);
    b = Bullet.newEnemyBullet(0, 0, 0.5f, 0.5f, 0.25f, bimg, world);
    e.setShootPattern(new AllRangeShoot(6, 1, 2f, e, b, 0.2f, 12));
    world.addEnemy(e);
    e =
        PointElf.newPointElf(
            (World.CAMERA_WIDTH + Butterfly.WIDTH) / 2f, World.CAMERA_HEIGHT, resources, world, 60);
    e.addAction(
        Actions.sequence(
            Actions.moveBy(0, -16f, 1), Actions.moveBy(0, 0, 3f), Actions.moveBy(0, 32f, 2)));
    e.setShootPattern(new AllRangeShoot(6, 1, 2f, e, b, 0.2f, 12));
    world.addEnemy(e);
    e =
        Butterfly.newButterfly(
            (World.CAMERA_WIDTH - Butterfly.WIDTH) / 2f,
            World.CAMERA_HEIGHT,
            resources,
            world,
            100);
    e.addAction(
        Actions.sequence(
            Actions.moveBy(0, -16f, 1), Actions.moveBy(0, 0, 3f), Actions.moveBy(0, 32f, 2)));
    bimg = new TextureRegion(rawImg, 32, 16, 16, 16);
    b = Bullet.newEnemyBullet(0, 0, 1f, 1f, 0.4f, bimg, world);
    b.setRotation(-90);
    b.setOrigin(b.getWidth() / 2f, b.getHeight() / 2f);
    e.setShootPattern(new AllRangeShoot(6, 1, 2, e, b, 0.2f, 36));
    world.addEnemy(e);
    checkTime(1000 >> 3);
    e =
        PowerElf.newPowerElf(
            (World.CAMERA_WIDTH - Butterfly.WIDTH) / 2f - PowerElf.WIDTH,
            World.CAMERA_HEIGHT,
            resources,
            world,
            60);
    e.addAction(
        Actions.sequence(
            Actions.moveBy(0, -14f, 14f / 16f),
            Actions.moveBy(0, 0, 3f),
            Actions.moveBy(0, 32f, 2)));
    bimg = new TextureRegion(rawImg, 32, 248, 8, 8);
    b = Bullet.newEnemyBullet(0, 0, 0.5f, 0.5f, 0.25f, bimg, world);
    e.setShootPattern(new AllRangeShoot(6, 1, 2f, e, b, 0.2f, 12));
    world.addEnemy(e);
    e =
        PointElf.newPointElf(
            (World.CAMERA_WIDTH + Butterfly.WIDTH) / 2f, World.CAMERA_HEIGHT, resources, world, 60);
    e.addAction(
        Actions.sequence(
            Actions.moveBy(0, -14f, 14f / 16f),
            Actions.moveBy(0, 0, 3f),
            Actions.moveBy(0, 32f, 2)));
    e.setShootPattern(new AllRangeShoot(6, 1, 2f, e, b, 0.2f, 12));
    world.addEnemy(e);

    // yinyangyu
    checkTime(6500);
    bimg = new TextureRegion(rawImg, 64, 208, 32, 32);
    b = Bullet.newEnemyBullet(0, 0, 2f, 2f, 0.8f, bimg, world);
    b.setRotation(-90);
    for (int i = 0; i < 5; ++i) {
      checkTime(500);
      e = PointYinyangyu.newPointYinyangyu(0, World.CAMERA_HEIGHT * 0.9f, resources, world, 50);
      e.setOrigin(0, -10);
      e.addAction(
          Actions.sequence(
              Actions.moveBy(15, 0, 1),
              Actions.repeat(2, Actions.rotateBy(-360, 4f)),
              Actions.moveBy(30, 0, 2)));
      e.setShootPattern(new AimShoot(300, 0.5f, 2, e, b, 1, 9, 0.4f));
      world.addEnemy(e);
      checkTime(500);
      e =
          PowerYinyangyu.newPowerYinyangyu(
              World.CAMERA_WIDTH, World.CAMERA_HEIGHT * 0.9f, resources, world, 50);
      e.setOrigin(0, -10);
      e.addAction(
          Actions.sequence(
              Actions.moveBy(-15, 0, 1),
              Actions.repeat(2, Actions.rotateBy(360, 4f)),
              Actions.moveBy(-30, 0, 2)));
      e.setShootPattern(new AimShoot(300, 0.5f, 2, e, b, 1, 9, 0.4f));
      world.addEnemy(e);
    }

    // elf
    checkTime(6500);
    bimg = new TextureRegion(rawImg, 208, 64, 16, 16);
    b = Bullet.newEnemyBullet(0, 0, 1, 1, 0.25f, bimg, world);
    b.setRotation(-90);
    for (int i = 0; i < 6; ++i) {
      checkTime(2000);
      for (int j = 0; j < 6; ++j) {
        e =
            PowerElf.newPowerElf(
                ((j << 1) + 1) * PowerElf.WIDTH, World.CAMERA_HEIGHT, resources, world, 40);
        e.addAction(
            Actions.repeat(
                RepeatAction.FOREVER,
                Actions.sequence(
                    Actions.moveBy(0, -2, 0.5f),
                    Actions.moveBy(2, 0, 0.5f),
                    Actions.moveBy(0, -2, 0.5f),
                    Actions.moveBy(-2, 0, 0.5f))));
        e.setShootPattern(new OneShoot(2, 0, 1f, e, b, 0.3f, -90));
        world.addEnemy(e);
      }
      checkTime(2000);
      for (int j = 0; j < 6; ++j) {
        e =
            PointElf.newPointElf(
                World.CAMERA_WIDTH - PointElf.WIDTH * ((j + 1) << 1),
                World.CAMERA_HEIGHT,
                resources,
                world,
                40);
        e.addAction(
            Actions.repeat(
                RepeatAction.FOREVER,
                Actions.sequence(
                    Actions.moveBy(0, -2, 0.5f),
                    Actions.moveBy(-2, 0, 0.5f),
                    Actions.moveBy(0, -2, 0.5f),
                    Actions.moveBy(2, 0, 0.5f))));
        e.setShootPattern(new OneShoot(2, 0, 1f, e, b, 0.3f, -90));
        world.addEnemy(e);
      }
    }

    // nue elf
    checkTime(24000);
    for (int i = 0; i < 4; ++i) {
      if (i % 2 == 0) {
        bimg = new TextureRegion(rawImg, 96, 96, 16, 16);
        b = Bullet.newEnemyBullet(0, 0, 1, 1, 0.25f, bimg, world);
        for (int j = 0; j < 10; ++j) {
          checkTime(300);
          e =
              PointElf.newPointElf(
                  World.CAMERA_WIDTH, World.CAMERA_HEIGHT * 0.8f, resources, world, 40);
          e.setOrigin(-20, 20);
          e.addAction(Actions.sequence(Actions.rotateBy(-180, 10), Actions.moveBy(100, 100)));
          final int n = i + 1;
          e.setShootPattern(
              new ShootPattern(10, 3 - j * 0.3f, 30, e, b, 0.4f) {
                @Override
                public void shoot() {
                  Bullet toShoot;
                  float deltaDeg = 360f / n;
                  float startDeg = parent.getRotation() - 90;
                  for (int k = 0; k < n; ++k) {
                    float deg = startDeg + k * deltaDeg;
                    toShoot = getBullet();
                    toShoot.setPosition(parent.getCheckX(), parent.getCheckY());
                    toShoot.setOrigin(toShoot.getWidth() / 2f, toShoot.getHeight() / 2f);
                    toShoot.setRotation(deg - 90);
                    toShoot.addAction(
                        Actions.repeat(
                            RepeatAction.FOREVER,
                            Actions.moveBy(
                                speed * MathUtils.cosDeg(deg), speed * MathUtils.sinDeg(deg))));
                    world.addEnemyBullet(toShoot);
                  }
                }
              });
          world.addEnemy(e);
        }
      } else {
        bimg = new TextureRegion(rawImg, 32, 96, 16, 16);
        b = Bullet.newEnemyBullet(0, 0, 1, 1, 0.25f, bimg, world);
        for (int j = 0; j < 10; ++j) {
          checkTime(300);
          e =
              PowerElf.newPowerElf(
                  -PowerElf.WIDTH, World.CAMERA_HEIGHT * 0.8f, resources, world, 60);
          e.setOrigin(20, 20);
          e.addAction(Actions.sequence(Actions.rotateBy(180, 10), Actions.moveBy(100, 100)));
          final int n = i + 1;
          e.setShootPattern(
              new ShootPattern(10, 3 - j * 0.3f, 30, e, b, 0.4f) {
                @Override
                public void shoot() {
                  Bullet toShoot;
                  float deltaDeg = 360f / n;
                  float startDeg = parent.getRotation() + 90;
                  for (int k = 0; k < n; ++k) {
                    float deg = startDeg + k * deltaDeg;
                    toShoot = getBullet();
                    toShoot.setPosition(parent.getCheckX(), parent.getCheckY());
                    toShoot.setOrigin(toShoot.getWidth() / 2f, toShoot.getHeight() / 2f);
                    toShoot.setRotation(deg - 90);
                    toShoot.addAction(
                        Actions.repeat(
                            RepeatAction.FOREVER,
                            Actions.moveBy(
                                speed * MathUtils.cosDeg(deg), speed * MathUtils.sinDeg(deg))));
                    world.addEnemyBullet(toShoot);
                  }
                }
              });
          world.addEnemy(e);
        }
      }
    }
  }