public void actionUp(final int action) {
      ACTION = ACTION_TURN_START;
      mScrollLeftSprite.setVisible(false);
      mScrollLeftSprite.clearEntityModifiers();
      mCubicStartAniSprite.animate(
          new long[] {300, 300, 300},
          new int[] {0, 1, 2},
          0,
          new IAnimationListener() {

            @Override
            public void onAnimationStarted(AnimatedSprite arg0, int arg1) {
              mCubicStartAniSprite.setVisible(true);
            }

            @Override
            public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {}

            @Override
            public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {}

            @Override
            public void onAnimationFinished(AnimatedSprite animatedSprite) {
              action(action);
            }
          });
    }
  private void drawUsingSpritesWithSharedVertexBuffer(final Scene pScene) {
    final IEntityModifier faceEntityModifier =
        new SequenceEntityModifier(
            new RotationByModifier(2, 90),
            new AlphaModifier(1.5f, 1, 0),
            new AlphaModifier(1.5f, 0, 1),
            new ScaleModifier(2.5f, 1, 0.5f),
            new DelayModifier(0.5f),
            new ParallelEntityModifier(
                new ScaleModifier(2f, 0.5f, 5), new RotationByModifier(2, 90)),
            new ParallelEntityModifier(
                new ScaleModifier(2f, 5, 1), new RotationModifier(2f, 180, 0)));

    /* As we are creating quite a lot of the same Sprites, we can let them share a VertexBuffer to significantly increase performance. */
    final ISpriteVertexBufferObject sharedVertexBuffer =
        new LowMemorySpriteVertexBufferObject(
            this.getVertexBufferObjectManager(),
            Sprite.SPRITE_SIZE,
            DrawType.STATIC,
            true,
            Sprite.VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT);

    for (int i = 0; i < SPRITE_COUNT; i++) {
      final Sprite face =
          new Sprite(
              (CAMERA_WIDTH - 32) * this.mRandom.nextFloat(),
              (CAMERA_HEIGHT - 32) * this.mRandom.nextFloat(),
              this.mFaceTextureRegion,
              sharedVertexBuffer);
      face.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
      face.registerEntityModifier(faceEntityModifier.deepCopy());

      pScene.attachChild(face);
    }
  }
Example #3
0
 private void spawnCar(final float screenWidth, final float screenHeight) {
   lane = r.nextInt(6) + 1;
   final Sprite car = new Sprite(-300, 0, carTR, this.activity.getVertexBufferObjectManager());
   car.setRotation(180);
   MoveModifier moveModifier =
       new MoveModifier(
           4,
           lane * GameManager.lengthOfTile,
           lane * GameManager.lengthOfTile,
           -GameManager.lengthOfTile * 2,
           screenHeight + GameManager.lengthOfTile * 2) {
         @Override
         protected void onModifierFinished(IEntity pItem) {
           super.onModifierFinished(pItem);
           lane = r.nextInt(6) + 1;
           this.reset(
               4,
               lane * GameManager.lengthOfTile,
               lane * GameManager.lengthOfTile,
               -GameManager.lengthOfTile * 2,
               screenHeight + GameManager.lengthOfTile * 2);
         }
       };
   car.registerEntityModifier(moveModifier);
   menuScene.attachChild(car);
 }
    public void clearAll() {
      this.setVisible(false);
      ACTION = ACTION_DEFAULT;
      this.unregisterUpdateHandler(timerHandler);
      mCubicStartAniSprite.clearEntityModifiers();
      mCubicStartAniSprite.clearUpdateHandlers();
      mCubicStartAniSprite.stopAnimation(0);
      mCubicStartAniSprite.setVisible(false);

      mCubicTurnAniSprite.clearEntityModifiers();
      mCubicTurnAniSprite.clearUpdateHandlers();
      mCubicTurnAniSprite.stopAnimation(0);
      mCubicTurnAniSprite.setVisible(false);

      mCubicStopAniSprite.clearEntityModifiers();
      mCubicStopAniSprite.clearUpdateHandlers();
      mCubicStopAniSprite.stopAnimation(0);
      mCubicStopAniSprite.setVisible(false);

      mScrollLeftSprite.clearEntityModifiers();
      mScrollLeftSprite.setVisible(false);

      for (int i = 0; i < mCubicTurnOptionAniSprite.length; i++) {
        mCubicTurnOptionAniSprite[i].setVisible(false);
        mCubicTurnOptionAniSprite[i].clearEntityModifiers();
        mCubicTurnOptionAniSprite[i].clearUpdateHandlers();
        mCubicTurnOptionAniSprite[i].stopAnimation();
      }

      removePhysics(this);
    }
  private void drawUsingSpriteBatch(final Scene pScene) {
    final IEntityModifier faceEntityModifier =
        new SequenceEntityModifier(
            new RotationByModifier(2, 90),
            new AlphaModifier(1.5f, 1, 0),
            new AlphaModifier(1.5f, 0, 1),
            new ScaleModifier(2.5f, 1, 0.5f),
            new DelayModifier(0.5f),
            new ParallelEntityModifier(
                new ScaleModifier(2f, 0.5f, 5), new RotationByModifier(2, 90)),
            new ParallelEntityModifier(
                new ScaleModifier(2f, 5, 1), new RotationModifier(2f, 180, 0)));

    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
    final SpriteGroup spriteGroup =
        new SpriteGroup(
            this.mFaceTexture, EntityModifierBenchmark.SPRITE_COUNT, vertexBufferObjectManager);
    spriteGroup.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    for (int i = 0; i < EntityModifierBenchmark.SPRITE_COUNT; i++) {
      final Sprite face =
          new Sprite(
              (EntityModifierBenchmark.CAMERA_WIDTH - 32) * this.mRandom.nextFloat(),
              (EntityModifierBenchmark.CAMERA_HEIGHT - 32) * this.mRandom.nextFloat(),
              this.mFaceTextureRegion,
              vertexBufferObjectManager);
      face.registerEntityModifier(faceEntityModifier.deepCopy());

      spriteGroup.attachChild(face);
    }

    pScene.attachChild(spriteGroup);
  }
    Button3(int buttonPosition) {
      super(
          0,
          Config.Camera.HEIGHT - button3Regions[buttonPosition % 3].getHeight(),
          button3Regions[buttonPosition % 3],
          vbom);

      // Log.e(tag, "Button3");
      float[] paddingLeft = {
        0, button3Regions[0].getWidth(), button3Regions[0].getWidth() + button3Regions[1].getWidth()
      };
      setX(paddingLeft[buttonPosition % 3]);
      position = buttonPosition;

      // add icon
      Sprite mIcon = new Sprite(getX(), getY(), buttonIconsRegions[levelNumber][0], vbom);

      if (levelNumber == 9 || levelNumber == 10 || levelNumber == 11) {
        mIcon = new Sprite(getX(), getY(), buttonIconsRegions[levelNumber][position], vbom);
      }

      mIcon.setZIndex(101);

      getScene().attachChild(mIcon);
      getScene().sortChildren();
    }
  private void effectRate(Rate mRate) {
    // Log.e(tag, "effectRate");

    Sprite sprite = fastSprite;

    switch (mRate) {
      case FAST:
        sprite = new Sprite(0, 0, Region.fast, vbom);
        break;
      case SUPER_FAST:
        sprite = new Sprite(0, 0, Region.superFast, vbom);
        break;
      case COMPLETE:
        sprite = new Sprite(0, 0, Region.complete, vbom);
        break;
      case WRONG:
        sprite = new Sprite(0, 0, Region.wrong, vbom);
        break;
      case SLOW:
        sprite = new Sprite(0, 0, Region.slow, vbom);
        break;
    }

    setToCenter(sprite);
    sprite.setScale(0);
    attachChild(sprite);

    sprite.registerEntityModifier(
        new SequenceEntityModifier(
            new ScaleAtModifier(0.2f, 0, 1, sprite.getWidth() / 2, sprite.getHeight() / 2),
            new AlphaModifier(0.3f, 1, 1),
            new AlphaModifier(0.1f, 1, 0)));
  }
 @Override
 public void disposeScene() {
   splash.detachSelf();
   splash.dispose();
   this.detachSelf();
   this.dispose();
 }
 private void detach(Sprite s, Sprite fromSprite) {
   // Log.e(tag, "detach");
   if (s != null) {
     fromSprite.detachChild(s);
     if (!s.isDisposed()) s.dispose();
     s = null;
   }
 }
Example #10
0
  @Override
  public void liberarEscena() {
    // Liberar cada recurso usado en esta escena
    spriteFondo.detachSelf(); // Se desconecta de la escena
    spriteFondo.dispose(); // Libera la memoria

    this.detachSelf(); // La escena se deconecta del engine
    this.dispose(); // Libera la memoria
  }
  protected void updateAngle() {
    if (mSprite.getRotation() > 360) {
      mSprite.setRotation(mSprite.getRotation() % 360);
      mSpriteShadow.setRotation(mSpriteShadow.getRotation() % 360);
    }

    mSprite.setRotation(mAngle);
    mSpriteShadow.setRotation(mAngle);
  }
Example #12
0
  @Override
  public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws Exception {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    scene = new Scene();
    scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));

    final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
    final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
    final Sprite face =
        new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
    final PhysicsHandler physicsHandler = new PhysicsHandler(face);
    face.registerUpdateHandler(physicsHandler);

    scene.attachChild(face);

    final AnalogOnScreenControl analogOnScreenControl =
        new AnalogOnScreenControl(
            0,
            CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight(),
            this.mCamera,
            this.mOnScreenControlBaseTextureRegion,
            this.mOnScreenControlKnobTextureRegion,
            0.1f,
            200,
            this.getVertexBufferObjectManager(),
            new IAnalogOnScreenControlListener() {
              @Override
              public void onControlChange(
                  final BaseOnScreenControl pBaseOnScreenControl,
                  final float pValueX,
                  final float pValueY) {
                physicsHandler.setVelocity(pValueX * 100, pValueY * 100);
              }

              @Override
              public void onControlClick(final AnalogOnScreenControl pAnalogOnScreenControl) {
                face.registerEntityModifier(
                    new SequenceEntityModifier(
                        new ScaleModifier(0.25f, 1, 1.5f), new ScaleModifier(0.25f, 1.5f, 1)));
              }
            });
    analogOnScreenControl
        .getControlBase()
        .setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    analogOnScreenControl.getControlBase().setAlpha(0.5f);
    analogOnScreenControl.getControlBase().setScaleCenter(0, 128);
    analogOnScreenControl.getControlBase().setScale(1.25f);
    analogOnScreenControl.getControlKnob().setScale(1.25f);
    analogOnScreenControl.refreshControlKnobPosition();

    scene.setChildScene(analogOnScreenControl);

    pOnCreateSceneCallback.onCreateSceneFinished(scene);
  }
 public void checkArrow() {
   if (CUBIC_SLOT[0] == false || CUBIC_SLOT[1] == false) {
     mArrowSprite.setVisible(true);
     mArrowSprite.clearEntityModifiers();
     mArrowSprite.registerEntityModifier(
         new LoopEntityModifier(
             new SequenceEntityModifier(
                 new AlphaModifier(0.5f, 0.2f, 1.0f), new AlphaModifier(0.5f, 1.0f, 0.2f))));
   } else {
     mArrowSprite.setVisible(false);
     mArrowSprite.clearEntityModifiers();
   }
 }
Example #14
0
 private void babyDontCry() {
   mMilkSprite.setVisible(false);
   A19_9B_5_NAKIGOE1.stop();
   mCryLeftSprite.clearEntityModifiers();
   mCryRightSprite.clearEntityModifiers();
   mCryLeftSprite.setVisible(false);
   mCryRightSprite.setVisible(false);
   if (mFingerAnimatedSprite[4].isAnimationRunning()) {
     mFingerAnimatedSprite[4].stopAnimation();
   }
   mFingerAnimatedSprite[4].setCurrentTileIndex(0);
   resetBaby();
 }
  public void imitateGame() {

    getMainActivity().hideAd();

    goSprite.setVisible(false);
    goSprite.clearEntityModifiers();

    readySprite.setVisible(false);
    readySprite.clearEntityModifiers();

    initTime();
    taskInit();
  }
Example #16
0
 private void createAim() {
   aim =
       new Sprite(0, 0, resourcesManager.aimTextureRegion, vbom) {
         @Override
         protected void preDraw(GLState pGLState, Camera pCamera) {
           super.preDraw(pGLState, pCamera);
           pGLState.enableDither();
         }
       };
   aim.setPosition(camera.getXMin() + camera.getWidth() / 2, camera.getHeight() / 2);
   aim.setSize(40, 40);
   getChildByIndex(1).attachChild(aim);
 }
    public CubicEntity(
        float pX,
        float pY,
        int pCubic,
        final ITiledTextureRegion pCubicStart,
        final ITiledTextureRegion pCubicTurn,
        final ITiledTextureRegion pCubicStop,
        final ITiledTextureRegion pCubicTurnOption[],
        ITextureRegion pTextureRegion) {
      super(pX, pY, pTextureRegion, mVertexBufferObjectManager);
      setAlpha(0.0f);
      TYPE = pCubic;
      mCubicStartAniSprite = new AnimatedSprite(0, 0, pCubicStart, mVertexBufferObjectManager);
      this.attachChild(mCubicStartAniSprite);
      mCubicStartAniSprite.setVisible(false);

      float turnX = getWidth() - pCubicTurn.getWidth();
      float turnY = getHeight() - pCubicTurn.getHeight();
      mCubicTurnAniSprite =
          new AnimatedSprite(turnX - 15, turnY - 15, pCubicTurn, mVertexBufferObjectManager);
      this.attachChild(mCubicTurnAniSprite);
      mCubicTurnAniSprite.setVisible(false);

      for (int i = 0; i < mCubicTurnOptionAniSprite.length; i++) {
        float turnOpX = getWidth() - pCubicTurnOption[i].getWidth();
        float turnOpY = getHeight() - pCubicTurnOption[i].getHeight();
        mCubicTurnOptionAniSprite[i] =
            new AnimatedSprite(turnOpX, turnOpY, pCubicTurnOption[i], mVertexBufferObjectManager);
        this.attachChild(mCubicTurnOptionAniSprite[i]);
        mCubicTurnOptionAniSprite[i].setVisible(false);
      }

      float stopX = getWidth() - pCubicTurn.getWidth();
      float stopY = getHeight() - pCubicTurn.getHeight();
      mCubicStopAniSprite =
          new AnimatedSprite(stopX - 15, stopY - 15, pCubicStop, mVertexBufferObjectManager);
      this.attachChild(mCubicStopAniSprite);
      mCubicStopAniSprite.setVisible(false);

      float scrollX = turnX + pCubicTurn.getWidth() / 2 - mScrollLeftTextureRegion.getWidth();
      float scrollY = turnY + pCubicTurn.getHeight() - mScrollLeftTextureRegion.getHeight();
      mScrollLeftSprite =
          new Sprite(scrollX, scrollY, mScrollLeftTextureRegion, mVertexBufferObjectManager);
      this.attachChild(mScrollLeftSprite);
      mScrollLeftSprite.setVisible(false);

      mScrollLeftSprite.registerEntityModifier(
          new LoopEntityModifier(
              new SequenceEntityModifier(
                  new AlphaModifier(0.5f, 0.2f, 1.0f), new AlphaModifier(0.5f, 1.0f, 0.2f))));
    }
Example #18
0
  public void addTarget() {
    Random rand = new Random();

    int minX = 0;
    int maxX = (int) (mCamera.getWidth() - activity.enemySprite.getWidth());
    int rangeX = maxX - minX;
    int y = (int) -activity.enemySprite.getHeight();
    int x = rand.nextInt(rangeX) - minX;

    Sprite target = new Sprite(x, y, activity.enemyRegion, activity.getVertexBufferObjectManager());
    target.setSize(
        activity.mCamera.getWidth() / 10.8f * 1.5f, activity.mCamera.getWidth() / 10.8f * 1.5f);

    target.setZIndex(3);

    attachChild(target);

    int minDuration = 3;
    int maxDuration = 6;
    int rangeDuration = maxDuration - minDuration;
    int actualDuration = rand.nextInt(rangeDuration) + minDuration;
    int actualMoveX = rand.nextInt((int) (mCamera.getWidth() - target.getWidth()));

    MoveModifier mod =
        new MoveModifier(
            actualDuration,
            target.getX(),
            actualMoveX,
            target.getY(),
            mCamera.getHeight() + target.getHeight());

    target.registerEntityModifier(mod.deepCopy());

    enemiesToBeAdded.add(target);
  }
  public SplashScene() {
    setBackground(new Background(0.f, 0f, .0f));
    activity = CamaleaotestActivity.getSharedInstance();

    mSplash = new Sprite(117, 177, activity.mSplashScreen, activity.getVertexBufferObjectManager());
    mSplash.setAlpha(0);
    this.attachChild(mSplash);
    mSplash.registerEntityModifier(
        new SequenceEntityModifier(
            new FadeInModifier(2) {
              @Override
              protected void onModifierFinished(IEntity pItem) {
                activity.loadAssets();
                super.onModifierFinished(pItem);
              }
            },
            new DelayModifier(5f) {
              @Override
              protected void onModifierFinished(IEntity pItem) {
                // TODO Auto-generated method stub
                super.onModifierFinished(pItem);
                mReady = true;
              }
            }));

    this.registerUpdateHandler(
        new IUpdateHandler() {
          @Override
          public void reset() {
            // TODO Auto-generated method stub

          }

          @Override
          public void onUpdate(float pSecondsElapsed) {
            if (activity.loading || !mReady) return;
            mSplash.registerEntityModifier(
                new FadeOutModifier(2f) {
                  @Override
                  protected void onModifierFinished(IEntity pItem) {
                    // TODO Auto-generated method stub
                    super.onModifierFinished(pItem);
                    activity.setCurrentScene(new MainMenuScene());
                  }
                });
          }
        });
  }
  @Override
  public void createScene() {

    splash =
        new Sprite(0, 0, resourcesManager.splashRegion, vbom) {

          protected void preDraw(GLState pGLState, Camera pCamera) {
            super.preDraw(pGLState, pCamera);
            pGLState.enableDither();
          }
        };

    splash.setScale(1.5f);
    splash.setPosition(35, 200);
    // attachChild(splash);
  }
  @Override
  public void onPauseGame() {
    if (!isDrawView || !isPreView) {
      return;
    }
    Log.i(TAG, "-- onPauseGame --");
    this.unregisterUpdateHandler(updateHandler);
    CUBIC_SLOT[0] = false;
    CUBIC_SLOT[1] = false;
    mArrowSprite.setVisible(false);
    mSuzuAniSprite.stopAnimation(0);
    mShishiAniSprite.stopAnimation();
    mShishiAniSprite.clearEntityModifiers();
    mShishiAniSprite.resetLocalToFirst();
    mShishiAniSprite.setVisible(false);

    for (int i = 0; i < mCubicEntity.length; i++) {
      if (mCubicEntity[i] != null) {
        mCubicEntity[i].clearAll();
      }
    }

    if (faceSequenceEntityModifier != null) {
      this.unregisterEntityModifier(faceSequenceEntityModifier);
      faceSequenceEntityModifier = null;
    }

    for (int i = 1; i < mTabSprite.length; i++) {
      mTabSprite[i].setVisible(false);
    }
  }
 @Override
 public void createScene() {
   createBackground();
   createMenuChildScene();
   menuChildScene.setZIndex(0);
   light.setZIndex(1);
   this.sortChildren();
 }
 private void checkForCollisionsWithTowers(Ring ring) {
   Stack stack = null;
   Sprite tower = null;
   if (ring.collidesWith(mTower1)
       && (mStack1.size() == 0 || ring.getmWeight() < ((Ring) mStack1.peek()).getmWeight())) {
     stack = mStack1;
     tower = mTower1;
   } else if (ring.collidesWith(mTower2)
       && (mStack2.size() == 0 || ring.getmWeight() < ((Ring) mStack2.peek()).getmWeight())) {
     stack = mStack2;
     tower = mTower2;
   } else if (ring.collidesWith(mTower3)
       && (mStack3.size() == 0 || ring.getmWeight() < ((Ring) mStack3.peek()).getmWeight())) {
     stack = mStack3;
     tower = mTower3;
   } else {
     stack = ring.getmStack();
     tower = ring.getmTower();
   }
   ring.getmStack().remove(ring);
   if (stack != null && tower != null && stack.size() == 0) {
     ring.setPosition(
         tower.getX() + tower.getWidth() / 2 - ring.getWidth() / 2,
         tower.getY() + tower.getHeight() - ring.getHeight());
   } else if (stack != null && tower != null && stack.size() > 0) {
     ring.setPosition(
         tower.getX() + tower.getWidth() / 2 - ring.getWidth() / 2,
         ((Ring) stack.peek()).getY() - ring.getHeight());
   }
   stack.add(ring);
   ring.setmStack(stack);
   ring.setmTower(tower);
 }
 public static void clearEntityModifiers(Sprite s) {
   s.unregisterEntityModifiers(
       new IEntityModifier.IEntityModifierMatcher() {
         @Override
         public boolean matches(IModifier<IEntity> iEntityIModifier) {
           return true;
         }
       });
 }
Example #25
0
  public Sprite getMenuBackground() {
    mMenuBackgroundRegion =
        BitmapTextureAtlasTextureRegionFactory.createFromAsset(
            mBuildableBitmapTextureAtlas, Game.getContext(), "menuback.png");
    try {
      mBuildableBitmapTextureAtlas.build(
          new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1));
      mBuildableBitmapTextureAtlas.load();
    } catch (TextureAtlasBuilderException e) {
      e.printStackTrace();
    }
    mMenuBackgroundSprite =
        new Sprite(0, 0, mMenuBackgroundRegion, Game.getContext().getVertexBufferObjectManager());
    mMenuBackgroundSprite.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    mMenuBackgroundSprite.setAlpha(0.2f);

    return mMenuBackgroundSprite;
  }
 public static void clearUpdateHandlers(Sprite s) {
   s.unregisterUpdateHandlers(
       new IUpdateHandler.IUpdateHandlerMatcher() {
         @Override
         public boolean matches(IUpdateHandler pObject) {
           return true;
         }
       });
 }
  public void effectMiss(int mPosition) {

    int[] x = {50, 150, 250};

    // Sprite sprite = new Sprite(0, 0, Region.miss, vbom);
    Sprite sprite = getMissFromPool();
    // if (sprite.getParent() != this) {
    this.attachChild(sprite);
    // }
    setToCenter(sprite);
    sprite.setX(x[mPosition]);

    sprite.registerEntityModifier(
        new SequenceEntityModifier(
            new ScaleAtModifier(0.3f, 0, 1, sprite.getWidth() / 2, sprite.getHeight() / 2),
            new AlphaModifier(0.3f, 1, 1),
            new AlphaModifier(0.3f, 1, 0)));
  }
 public void addShadow(TextureRegion textureRegion) {
   mSpriteShadow =
       new Sprite(
           mSprite.getX() + mPointShadow.x,
           mSprite.getY() + mPointShadow.y,
           textureRegion,
           mSprite.getVertexBufferObjectManager());
   mSpriteShadow.setScale(Config.SCALE);
 }
Example #29
0
  private void babyDring() {
    isHand = false;
    isUongSua = true;
    mMilkSprite.setVisible(false);
    mCryLeftSprite.setVisible(false);
    mCryRightSprite.setVisible(false);
    mCryLeftSprite.clearEntityModifiers();
    mCryRightSprite.clearEntityModifiers();
    A19_9B_5_NAKIGOE1.stop();
    A19_10_CHU.play();
    playSoundDelay(0.75f, A19_9D_5_WARAIGOE1);
    mFingerAnimatedSprite[4].animate(
        new long[] {750, 1200},
        new int[] {8, 9},
        0,
        new IAnimationListener() {

          @Override
          public void onAnimationFinished(AnimatedSprite arg0) {
            isHand = true;
            isUongSua = false;
            resetBaby();
            mFingerAnimatedSprite[4].setCurrentTileIndex(0);
          }

          @Override
          public void onAnimationFrameChanged(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationLoopFinished(AnimatedSprite arg0, int arg1, int arg2) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationStarted(AnimatedSprite arg0, int arg1) {
            // TODO Auto-generated method stub

          }
        });
  }
  void AnimateImage() {
    Log.d("TiledImage", "ObjNo: " + ObjNo);
    if (ObjNo == 2) {
      anotherDelay = 10.0f;
      // anotherCounter=1;
    } else if (ObjNo == 3) {
      anotherDelay = 12.1f;
      // anotherCounter=1;
    } else if (ObjNo == 4) {
      anotherDelay = 14.1f;
      // anotherCounter=1;
    } else if (ObjNo == 5) {
      anotherDelay = 16.1f;
      // anotherCounter=1;
    } else if (ObjNo == 6) {
      anotherDelay = 18.1f;
      // anotherCounter=1;
    } else if (ObjNo == 7) {
      anotherDelay = 20.1f;
      // anotherCounter=1;
    } else {
      anotherDelay = 22.3f;
    }
    Log.d(
        "TiledImage",
        "ObjNo: " + ObjNo + " anotherDelay: " + anotherDelay + " total: " + ObjNo * anotherDelay);

    DelayModifier dMod =
        new DelayModifier(
            anotherDelay,
            new IEntityModifierListener() {
              @Override
              public void onModifierStarted(IModifier<IEntity> arg0, IEntity arg1) {}

              @Override
              public void onModifierFinished(IModifier<IEntity> arg0, IEntity arg1) {
                Letter.setVisible(true);
                s.setVisible(true);

                audioPlay = true;
                playAudio(audio);

                audioPlayCount++;
                if (audioPlayCount == 6) {
                  audioPlay = true;
                  AnimatedBookActivity.ArrowTouchEnable = true;
                  // ObjNo=0;
                }
              }
            });
    FadeInModifier macch_fim2 = new FadeInModifier(APPEARING_TIME);
    SequenceEntityModifier macch_sm = new SequenceEntityModifier(dMod, macch_fim2);

    Letter.registerEntityModifier(macch_sm);
  }