@Override
 public void onScrollFinished(
     ScrollDetector pScollDetector, int pPointerID, float pDistanceX, float pDistanceY) {
   mBossSlider.clearEntityModifiers();
   if (directionPath > 0f) {
     if (mCurrentBoss == 1) {
       mBossSlider.registerEntityModifier(
           new MoveXModifier(0.3F, mBossSlider.getX(), mBossSlider.getWidth() / 2f));
     } else {
       mCurrentBoss--;
       themeRInitX = themeRInitX + mCameraWidth;
       mBossSlider.registerEntityModifier(
           new MoveXModifier(0.3F, mBossSlider.getX(), themeRInitX));
     }
   } else {
     if (mCurrentBoss == bossPics.length) {
       mBossSlider.registerEntityModifier(
           new MoveXModifier(
               0.3F,
               mBossSlider.getX(),
               mBossSlider.getWidth() / 2f - mCameraWidth * (bossPics.length - 1)));
     } else {
       mCurrentBoss++;
       themeRInitX = themeRInitX - mCameraWidth;
       mBossSlider.registerEntityModifier(
           new MoveXModifier(0.3F, mBossSlider.getX(), themeRInitX));
     }
   }
 }
  private void addRectangleWithTension(final Scene pScene, final float pTension, float pDelay) {
    final Rectangle rectangle =
        new Rectangle(-SIZE, -SIZE, SIZE, SIZE, this.getVertexBufferObjectManager());
    rectangle.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE);
    if (pTension < 0) {
      rectangle.setColor(1 - pTension, 0, 0, 0.5f);
    } else {
      rectangle.setColor(pTension, 0, 0, 0.5f);
    }

    final CardinalSplineMoveModifierConfig catmullRomMoveModifierConfig1 =
        new CardinalSplineMoveModifierConfig(
            CardinalSplineMoveModifierExample.CONTROLPOINT_1_XS.length, pTension);
    final CardinalSplineMoveModifierConfig catmullRomMoveModifierConfig2 =
        new CardinalSplineMoveModifierConfig(
            CardinalSplineMoveModifierExample.CONTROLPOINT_1_XS.length, pTension);

    for (int i = 0; i < CardinalSplineMoveModifierExample.CONTROLPOINT_1_XS.length; i++) {
      catmullRomMoveModifierConfig1.setControlPoint(
          i,
          CardinalSplineMoveModifierExample.CONTROLPOINT_1_XS[i] - SIZE / 2,
          CardinalSplineMoveModifierExample.CONTROLPOINT_YS[i] - SIZE / 2);
      catmullRomMoveModifierConfig2.setControlPoint(
          i,
          CardinalSplineMoveModifierExample.CONTROLPOINT_2_XS[i] - SIZE / 2,
          CardinalSplineMoveModifierExample.CONTROLPOINT_YS[i] - SIZE / 2);
    }

    rectangle.registerEntityModifier(
        new SequenceEntityModifier(
            new DelayModifier(pDelay),
            new LoopEntityModifier(
                new SequenceEntityModifier(
                    new ParallelEntityModifier(
                        new CardinalSplineMoveModifier(
                            CardinalSplineMoveModifierExample.DURATION,
                            catmullRomMoveModifierConfig1,
                            EaseLinear.getInstance()),
                        new RotationModifier(
                            CardinalSplineMoveModifierExample.DURATION, -45, -315)),
                    new ParallelEntityModifier(
                        new CardinalSplineMoveModifier(
                            CardinalSplineMoveModifierExample.DURATION,
                            catmullRomMoveModifierConfig2,
                            EaseLinear.getInstance()),
                        new RotationModifier(
                            CardinalSplineMoveModifierExample.DURATION, 45, 315))))));

    pScene.attachChild(rectangle);
  }