@Override
  public boolean onAreaTouched(
      TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {

    int action = pSceneTouchEvent.getAction();

    switch (action) {
      case TouchEvent.ACTION_UP:
        if (mState
            == BallState.MOVING) { // ball state needed because actionup was being called twice
          handleReleaseSprite(pSceneTouchEvent);
          mState = BallState.STOPPED;
        }
        break;
      case TouchEvent.ACTION_DOWN:
        if (mState == BallState.STOPPED) {
          baseBoardX = board.getBoardXfromYCoord(getAngleY(this.mY));
          baseBoardY = board.getBoardYfromXCoord(getAngleX(this.mX));
          mState = BallState.MOVING;
        }

      default:
        if (mState == BallState.MOVING) {
          this.setPosition(
              pSceneTouchEvent.getX() - this.getWidth() / 2,
              pSceneTouchEvent.getY() - this.getHeight() / 2);
        }
        break;
    }

    return true;
  }
Example #2
0
  @Override
  public boolean onAreaTouched(
      final TouchEvent pSceneTouchEvent,
      final float pTouchAreaLocalX,
      final float pTouchAreaLocalY) {
    if (!this.isEnabled()) {
      this.changeState(State.DISABLED);
    } else if (pSceneTouchEvent.isActionDown()) {
      if (this.mState != State.PRESSED) {
        doPressedDown(pTouchAreaLocalX, pTouchAreaLocalY);
      } else {
        doUnpressed(pTouchAreaLocalX, pTouchAreaLocalY);
      }
    } else if (pSceneTouchEvent.isActionCancel()) {
      doCancelled();
    } else if (pSceneTouchEvent.isActionUp()) {
      boolean contains = this.contains(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
      if (this.mState == State.PRESSED && !this.mIsBistable && contains) {
        doUnpressed(pTouchAreaLocalX, pTouchAreaLocalY);
      } else if (!contains) {
        doCancelled();
      }
    }

    return true;
  }
 @Override
 protected void onRecycle() {
   super.onRecycle();
   final TouchEvent touchEvent = this.mTouchEvent;
   touchEvent.getMotionEvent().recycle();
   touchEvent.recycle();
 }
Example #4
0
 public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
   if (pSceneTouchEvent.isActionDown()) {
     if (this.isPaused) {
       this.resume();
     } else if (this.isWin) {
       this.onBackKeyPressed();
     } else {
       if (pSceneTouchEvent.getY() >= 240) {
         // Jump
         if (this.player.isSwapped()) {
           this.player.roll();
         } else {
           this.player.jump();
         }
       } else if (pSceneTouchEvent.getY() < 240) {
         // Roll
         if (this.player.isSwapped()) {
           this.player.jump();
         } else {
           this.player.roll();
         }
       }
     }
   }
   return false;
 }
    @Override
    public boolean onAreaTouched(
        TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
      float pX = pSceneTouchEvent.getX();
      float pY = pSceneTouchEvent.getY();

      if (pSceneTouchEvent.isActionDown()) {
        if (checkContainsPolygon(mTabSprite[0], POINTER_FACE, 8, pX, pY)) {
          Log.i(TAG, "Touch to body Face !");
          actionFace();
        }

        if (mCubicChooseSpite[CUBIC_ORANGE].contains(pX, pY)
            && mCubicChooseSpite[CUBIC_ORANGE].isVisible()) {
          insertCubicToTab(CUBIC_ORANGE);
        } else if (mCubicChooseSpite[CUBIC_BLUE].contains(pX, pY)
            && mCubicChooseSpite[CUBIC_BLUE].isVisible()) {
          insertCubicToTab(CUBIC_BLUE);
        } else if (mCubicChooseSpite[CUBIC_GREEN].contains(pX, pY)
            && mCubicChooseSpite[CUBIC_GREEN].isVisible()) {
          insertCubicToTab(CUBIC_GREEN);
        } else if (mCubicChooseSpite[CUBIC_YELLOW].contains(pX, pY)
            && mCubicChooseSpite[CUBIC_YELLOW].isVisible()) {
          insertCubicToTab(CUBIC_YELLOW);
        }
      }
      return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
    }
  public void onPinchZoom(
      final PinchZoomDetector pPinchZoomDetector,
      final TouchEvent pTouchEvent,
      final float pZoomFactor) {

    final float zoomFactor = this.mZoomCamera.getZoomFactor();
    float newX =
        ((pTouchEvent.getMotionEvent().getX(0) / this.mPinchZoomStartedCameraZoomFactor)
                + (pTouchEvent.getMotionEvent().getX(1) / this.mPinchZoomStartedCameraZoomFactor))
            / 2;
    float newY =
        ((pTouchEvent.getMotionEvent().getY(0) / this.mPinchZoomStartedCameraZoomFactor)
                + (pTouchEvent.getMotionEvent().getY(1) / this.mPinchZoomStartedCameraZoomFactor))
            / 2;

    this.mZoomCamera.offsetCenter((prevX - (newX)), (prevY - newY));

    prevX = newX;
    prevY = newY;
    // this.mZoomCamera.setZoomFactor(this.mPinchZoomStartedCameraZoomFactor
    // * pZoomFactor);
    if (this.mPinchZoomStartedCameraZoomFactor * pZoomFactor > MAX_ZOOM) {
      this.mZoomCamera.setZoomFactor(MAX_ZOOM);
    } else if (this.mPinchZoomStartedCameraZoomFactor * pZoomFactor < MIN_ZOOM) {
      this.mZoomCamera.setZoomFactor(MIN_ZOOM);
    } else {
      this.mZoomCamera.setZoomFactor(this.mPinchZoomStartedCameraZoomFactor * pZoomFactor);
    }

    /*centerText.setText("(" + mZoomCamera.getCenterX() + ","
    + mZoomCamera.getCenterY() + ")\n" + "zoomFactor = "
    + zoomFactor + "\n");*/
  }
  public void onTapFromGame(TouchEvent event) {
    Debug.d("tap on " + event.getX() + "x" + event.getY());

    //		SoundLibrary.playSample(Sample.LASER); //AG: lo he movido a TouchProcess

    //		SoundLibrary.playSample(Sample.CHEWAKA);
    //		SoundLibrary.stopSample(Sample.CHEWAKA, true, 2);
  }
        @Override
        public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
          // TODO Auto-generated method stub
          if (pSceneTouchEvent.isActionDown()) {
            newPlayerPositionX = pSceneTouchEvent.getMotionEvent().getX();
            newPlayerPositionY = pSceneTouchEvent.getMotionEvent().getY();
            System.out.println("NewPosition:" + newPlayerPositionX + "," + newPlayerPositionY);

            isPlayerMoving = true;
          }
          return true;
        }
Example #9
0
  public void testConvertSceneToSurfaceTouchEventNonCenter() {
    this.mCamera.setCenter(0, 0);

    final TouchEvent touchEvent = TouchEvent.obtain(-50, -50, TouchEvent.ACTION_DOWN, 0, null);

    final int surfaceWidth = 100;
    final int surfaceHeight = 100;

    this.mCamera.convertSceneToSurfaceTouchEvent(touchEvent, surfaceWidth, surfaceHeight);

    Assert.assertEquals(0, touchEvent.getX(), DELTA);
    Assert.assertEquals(0, touchEvent.getY(), DELTA);
  }
Example #10
0
  @Override
  public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

    if (pSceneTouchEvent.isActionDown()) {
      int cX = (int) pSceneTouchEvent.getX();
      int cY = (int) pSceneTouchEvent.getY(); /*
			int cX = (int)pSceneTouchEvent.getMotionEvent().getX();
			int cY = (int)pSceneTouchEvent.getMotionEvent().getY();*/
      // this.targetX = this.currX + (cX - this.CAMERA_WIDTH/2);
      // this.targetY = this.currY + (cY - this.CAMERA_HEIGHT/2);
      this.targetX = cX;
      this.targetY = cY;
      // TODO: border case
      // scene.attachChild(new Sprite(cX,cY, this.mLouisTextureRegion,
      // getVertexBufferObjectManager()));
      /*
      dX = 10;
      dY = 10;
      System.out.print("clicked!");
      if (pSceneTouchEvent.getX() < CAMERA_WIDTH/2)
      {
      	dX = -10;
      }
      if (pSceneTouchEvent.getY() < CAMERA_HEIGHT/2)
      {
      	dY = -10;
      }*/

      // cene.clearChildScene();

      /*if (counter < text.length - 1)
      	counter++;
      mText = new Text(100, 40, mFont, text[counter], new TextOptions(HorizontalAlign.CENTER), this.getVertexBufferObjectManager());
      scene.attachChild(backgroundSprite);
      if (counter % 2 == 0)
      	scene.attachChild(mRobin);
      else
      	scene.attachChild(mLouis);
      scene.attachChild(mText);*/
      return true;
    }
    /*
    if (pSceneTouchEvent.isActionMove())
    {
    	pScene.attachChild(mRobin);
    	return true;
    }*/

    return false;
  }
        @Override
        public boolean onAreaTouched(
            TouchEvent pSceneTouchEvent,
            ITouchArea pTouchArea,
            float pTouchAreaLocalX,
            float pTouchAreaLocalY) {
          newPlayerPositionX = pSceneTouchEvent.getX();
          newPlayerPositionY = pSceneTouchEvent.getY();
          oldPlayerPositionX = playerSprite.getX();
          oldPlayerPositionY = playerSprite.getY();

          System.out.println("NewPosition:" + newPlayerPositionX + "," + newPlayerPositionY);

          return true;
        }
 @Override
 public boolean onSceneTouchEvent(TouchEvent pSceneTouchEvent) {
   if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP) {
     cubicTouch.onAreaTouched(pSceneTouchEvent, 0, 0);
   }
   return super.onSceneTouchEvent(pSceneTouchEvent);
 }
Example #13
0
 @Override
 public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
   if (pSceneTouchEvent.isActionUp()) {
     SceneManager.getInstance().loadMenuScene(this);
   }
   return false;
 }
Example #14
0
  @Override
  public boolean onAreaTouched(
      final TouchEvent pSceneTouchEvent,
      final float pTouchAreaLocalX,
      final float pTouchAreaLocalY) {

    if (checked) return true;

    int eventAction = pSceneTouchEvent.getAction();

    switch (eventAction) {
      case TouchEvent.ACTION_DOWN:
        {
          if (correct) {
            checked = true;
            // private final long correctFrameDuration[] = {300, 300, 1400};
            // private final int correctFrameNumers[] = {1, 0, 1};
            animate(correctFrameDuration, correctFrameNumers, false, correctAnimationListener);
          } else {
            // private final long frameDuration[] = {300, 300};
            // private final int frameNumers[] = {2, 0};
            // private final int loopCount = 3;
            animate(wrongFrameDuration, wrongFrameNumers, wrongLoopCount, wrongAnimationListener);
          }
          break;
        }
      default:
        return true;
    }

    return true;
  }
Example #15
0
  public float handleSceneTouch(TouchEvent pSceneTouchEvent) {
    Vector2 v =
        new Vector2(
            getHead().getX() - pSceneTouchEvent.getX(), getHead().getY() - pSceneTouchEvent.getY());

    float angle = v.getAngle();
    if ((0 <= angle && angle <= 45) || (315 < angle && angle < 360)) {
      setDirection(SnakeDirection.RIGHT);
    } else if (45 < angle && angle <= 135) {
      setDirection(SnakeDirection.UP);
    } else if (135 < angle && angle <= 225) {
      setDirection(SnakeDirection.LEFT);
    } else if (225 < angle && angle <= 315) {
      setDirection(SnakeDirection.DOWN);
    }
    return angle;
  }
 @Override
 public boolean onAreaTouched(TouchEvent te, float x, float y) {
   // Log.e(tag, "onAreaTouched");
   if (te.isActionUp()) {
     onClick();
   }
   return super.onAreaTouched(te, x, y);
 }
 @Override
 protected Camera getCameraFromSurfaceTouchEvent(final TouchEvent pTouchEvent) {
   if (pTouchEvent.getX() <= this.mSurfaceWidth >> 1) {
     return this.getFirstCamera();
   } else {
     return this.getSecondCamera();
   }
 }
Example #18
0
    @Override
    public boolean onAreaTouched(
        TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
      if (!this.isVisible()) {
        return true;
      }
      if (pSceneTouchEvent.isActionDown()) {
        this.clearEntityModifiers();
        A19_10_POMI.play();
      } else if (pSceneTouchEvent.isActionMove()) {
        this.setPosition(
            pSceneTouchEvent.getX() - this.getWidth() / 2,
            pSceneTouchEvent.getY() - this.getHeight() / 2);
        if (checkContains(
            mFingerAnimatedSprite[4],
            57,
            43,
            185,
            171,
            (int) pSceneTouchEvent.getX(),
            (int) pSceneTouchEvent.getY())) {

          babyDring();
          this.setPosition(this.PX, this.PY);
          this.setVisible(false);
        }
      } else if (pSceneTouchEvent.isActionUp()) {
        this.setPosition(this.PX, this.PY);
        this.rotateAction();
      }
      return true;
    }
  /**
   * When the user releases the ball
   *
   * @param t
   */
  private void handleReleaseSprite(TouchEvent t) {
    int releaseBoardY = board.getBoardYfromXCoord(t.getX());
    int releaseBoardX = board.getBoardXfromYCoord(t.getY());

    // if something happens I restore the ball in its original place
    try {
      board.moveBall(baseBoardX, baseBoardY, releaseBoardX, releaseBoardY);

      setPosition(releaseBoardX, releaseBoardY);
    } catch (CantMoveException e) {
      setPosition(baseBoardX, baseBoardY);
    } catch (CantFillException e) {
      setPosition(baseBoardX, baseBoardY);
    }

    baseBoardX = 0;
    baseBoardY = 0;
  }
Example #20
0
 @Override
 public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {
   if (this.mPhysicsWorld != null) {
     // When player touch the screen
     if (pSceneTouchEvent.isActionDown()) {
       this.jumpMario(mario);
       return true;
     }
   }
   return false;
 }
  @Override
  public boolean onSceneTouchEvent(Scene scene, TouchEvent touchEvent) {
    if (super.mmsContext.getDialog() != null && super.mmsContext.getDialog().isShowing()) {
      return ((DialogScene) super.mmsContext).onSceneTouchEvent(touchEvent);
    }

    if (this.sCurrent != null && this.sCurrent.isShowing())
      return this.sCurrent.onSceneTouchEvent(scene, touchEvent);

    if (this.baTouchBoundary == null)
      this.baTouchBoundary = new BoundaryAdapter(touchEvent.getX(), touchEvent.getY(), 1f, 1f);
    else this.baTouchBoundary.set(touchEvent.getX(), touchEvent.getY(), 1f, 1f);

    this.handleRotateCharTouchEvent(touchEvent);

    final boolean scrollContainerEvent =
        !this.isRotatingSkin && this.scLeftSideContainer.onTouchEvent(touchEvent);
    if (!scrollContainerEvent) return super.onSceneTouchEvent(scene, touchEvent);
    else return true;
  }
  private void handleRotateCharTouchEvent(TouchEvent touchEvent) {
    if (touchEvent.isActionDown()
        && Boundary.BoundaryUtils.isIntersecting(this.baPlayerBoundary, this.baTouchBoundary)) {
      this.isRotatingSkin = true;
      this.rotateCharInitalTouchX = touchEvent.getX();
      this.sRotateChar.setAlpha(1f);
    } else if (touchEvent.isActionUp()) {
      this.isRotatingSkin = false;
      this.sRotateChar.setAlpha(1f);
    }

    if (this.isRotatingSkin)
      if (touchEvent.isActionMove()) {
        final float DELTA = this.rotateCharInitalTouchX - touchEvent.getX();
        final float DELTA_ABS = Math.abs(DELTA);

        if (DELTA_ABS > MainMenuEditPlayer.ROTATE_MOVE_SENSITIVITY) {
          final int STEPS =
              (int) Math.floor(DELTA_ABS / MainMenuEditPlayer.ROTATE_MOVE_SENSITIVITY);

          MainMenuEditPlayer.skinMoveDirectionIndex += (DELTA > 0) ? STEPS : -STEPS;

          if (MainMenuEditPlayer.skinMoveDirectionIndex < 0)
            MainMenuEditPlayer.skinMoveDirectionIndex += Direction.values().length - 1;
          else if (MainMenuEditPlayer.skinMoveDirectionIndex > Direction.values().length - 2)
            MainMenuEditPlayer.skinMoveDirectionIndex -= Direction.values().length - 2;
          this.rotateCharInitalTouchX = touchEvent.getX();
          this.directPlayerSkin();
        }
      }
  }
Example #23
0
  @Override
  public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
      int pX = (int) pSceneTouchEvent.getX();
      int pY = (int) pSceneTouchEvent.getY();

      if (mKaigaAnimatedSprite.contains(pX, pY)) {
        nextTileAnimatedSprite(mKaigaAnimatedSprite);
        A19_04_SAKUTON2.play();
      } else if (mTvAnimatedSprite.contains(pX, pY) && isTv && isHand) {
        isHand = false;
        tvAction();
        babyDontCry();
        resetBaby();
      } else if (checkContains(mClockAnimatedSprite, 29, 0, 171, 171, pX, pY) && isClock) {
        clockAction();
      } else if (checkContains(mDoorAnimatedSprite, 144, 26, 218, 383, pX, pY)
          && isDoor
          && isHand) {
        isHand = false;
        doorAction();
        babyDontCry();
        resetBaby();
      } else if (checkContains(mHandDefaultSprite, 227, 312, 454, 426, pX, pY) && isHand) {
        isHand = false;
        jankenAction();
        resetBaby();
      }
    }
    if (pSceneTouchEvent.isActionUp()) {
      if (mTempFringerAnimatedSprite != null) {
        if (mTempFringerAnimatedSprite.isAnimationRunning()) {
          mTempFringerAnimatedSprite.stopAnimation(0);
          mTempFringerAnimatedSprite = null;
        }
      }
      Log.d(TAG, " upup ,,,,,,,,,,,,,,,,,,,");
    }
    return true;
  }
  @Override
  protected void convertSurfaceToSceneTouchEvent(
      final Camera pCamera, final TouchEvent pSurfaceTouchEvent) {
    final int surfaceWidthHalf = this.mSurfaceWidth >> 1;

    if (pCamera == this.getFirstCamera()) {
      pCamera.convertSurfaceToSceneTouchEvent(
          pSurfaceTouchEvent, surfaceWidthHalf, this.mSurfaceHeight);
    } else {
      pSurfaceTouchEvent.offset(-surfaceWidthHalf, 0);
      pCamera.convertSurfaceToSceneTouchEvent(
          pSurfaceTouchEvent, surfaceWidthHalf, this.mSurfaceHeight);
    }
  }
    @Override
    public boolean onAreaTouched(
        TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {

      if (pSceneTouchEvent.isActionDown()) {
        // Log.i(TAG, "Touch CubicTouch isActionDown");
        if (checkContains(
            mSuzuAniSprite, 113, 30, 251, 202, (int) pTouchAreaLocalX, (int) pTouchAreaLocalY)) {
          Log.i(TAG, "Touch to ActionSuzuShiShi !");
          actionSuzuShiShi();
          return true;
        }
        for (int i = 0; i < mCubicEntity.length; i++) {
          if (mCubicEntity[i].isVisible()
              && mCubicEntity[i]
                  .getCubicBody()
                  .contains(pSceneTouchEvent.getX(), pSceneTouchEvent.getY())) {
            pxMOVE = pSceneTouchEvent.getX();
            if (mCubicEntity[i].actionDown() > 0) {
              Log.i(TAG, "Touch CubicTouch > 0");
            } else {
              Log.i(TAG, "Touch CubicTouch < 0 " + i);
              CUBICID = i;
            }
            return true;
          }
        }
      } else if (pSceneTouchEvent.isActionMove()) {
        // Log.i(TAG, "Touch CubicTouch isActionMove");
      } else if (pSceneTouchEvent.isActionUp()) {
        Log.i(TAG, "Touch CubicTouch isActionUp" + CUBICID);
        if (CUBICID >= 0 && mCubicEntity[CUBICID].getCubicAction() == CubicEntity.ACTION_DEFAULT) {
          float offset = pSceneTouchEvent.getX() - pxMOVE;
          if (offset < 0) {
            if (Math.abs(offset) >= 350) {
              Log.i(TAG, "Level 3");
              mCubicEntity[CUBICID].actionUp(CubicEntity.ACTION_TURN_LEVEL_3);
            } else if (Math.abs(offset) >= 200) {
              Log.i(TAG, "Level 2");
              mCubicEntity[CUBICID].actionUp(CubicEntity.ACTION_TURN_LEVEL_2);
            } else if (Math.abs(offset) >= 0) {
              Log.i(TAG, "Level 1");
              mCubicEntity[CUBICID].actionUp(CubicEntity.ACTION_TURN_LEVEL_1);
            }
          }
        }

        CUBICID = -1;
      }
      return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
    }
Example #26
0
  @Override
  public boolean onAreaTouched(
      TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
    if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_DOWN) {
      if (pTouchAreaLocalX > this.getWidth()
          || pTouchAreaLocalX < 0f
          || pTouchAreaLocalY > this.getHeight()
          || pTouchAreaLocalY < 0f) {
        mTouchStartedOnThis = false;
      } else {
        mTouchStartedOnThis = true;
      }

      if (mIsEnabled) mIsTouched = true;
    } else if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_MOVE) {
      if (mTouchStartedOnThis)
        if (pTouchAreaLocalX > this.getWidth()
            || pTouchAreaLocalX < 0f
            || pTouchAreaLocalY > this.getHeight()
            || pTouchAreaLocalY < 0f) {
          if (mIsTouched) {
            mIsTouched = false;
          }
        } else {
          if (!mIsTouched && mTouchStartedOnThis) if (mIsEnabled) mIsTouched = true;
        }
    } else if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP
        && mIsTouched
        && mTouchStartedOnThis) {
      mIsTouched = false;
      mIsClicked = true;
      mTouchStartedOnThis = false;
      SFXManager.playClick(1f, 0.5f);
    }
    return true;
  }
  protected boolean fireTouchEvent(
      final float pX,
      final float pY,
      final int pAction,
      final int pPointerID,
      final MotionEvent pMotionEvent) {
    final TouchEvent touchEvent =
        TouchEvent.obtain(pX, pY, pAction, pPointerID, MotionEvent.obtain(pMotionEvent));

    final TouchEventRunnablePoolItem touchEventRunnablePoolItem =
        this.mTouchEventRunnablePoolUpdateHandler.obtainPoolItem();
    touchEventRunnablePoolItem.set(touchEvent);
    this.mTouchEventRunnablePoolUpdateHandler.postPoolItem(touchEventRunnablePoolItem);
    return true;
  }
Example #28
0
  @Override
  public boolean onSceneTouchEvent(TouchEvent pSceneTouchEvent) {

    if (pSceneTouchEvent.isActionDown() && !personajeSaltando) {
      personajeSaltando = true;
      // Animar sprite central
      JumpModifier salto =
          new JumpModifier(
              1,
              spritePersonaje.getX(),
              spritePersonaje.getX(),
              spritePersonaje.getY(),
              spritePersonaje.getY(),
              -200);
      RotationModifier rotacion = new RotationModifier(1, 360, 0);
      ParallelEntityModifier paralelo =
          new ParallelEntityModifier(salto, rotacion) {
            @Override
            protected void onModifierFinished(IEntity pItem) {
              personajeSaltando = false;
              unregisterEntityModifier(this);
              super.onModifierFinished(pItem);
            }
          };
      spritePersonaje.registerEntityModifier(paralelo);
    }

    if (pSceneTouchEvent.isActionDown()) {
      // El usuario toca la pantalla
      float x = pSceneTouchEvent.getX();
      float y = pSceneTouchEvent.getY();
      spritePersonaje.setPosition(x, y);
    }
    if (pSceneTouchEvent.isActionMove()) {
      // El usuario mueve el dedo sobre la pantalla
      float x = pSceneTouchEvent.getX();
      float y = pSceneTouchEvent.getY();
      spritePersonaje.setPosition(x, y);
    }
    if (pSceneTouchEvent.isActionUp()) {
      // El usuario deja de tocar la pantalla
    }

    return super.onSceneTouchEvent(pSceneTouchEvent);
  }
 @Override
 public boolean onAreaTouched(TouchEvent touchEvent, float X, float Y) {
   switch (touchEvent.getAction()) {
     case TouchEvent.ACTION_DOWN:
       this.insButtonOFF.setVisible(false);
       this.insButtonON.setVisible(true);
       return true;
     case TouchEvent.ACTION_UP:
       this.insButtonOFF.setVisible(true);
       this.insButtonON.setVisible(false);
       if (mMessageHandler != null && this.mMessages.size() > 0)
         mMessageHandler.doOperation(this.mMessages.get(0));
       return true;
     default:
       return true;
   }
 }
  @Override
  public boolean onManagedTouchEvent(final TouchEvent pSceneTouchEvent) {
    final MotionEvent motionEvent = pSceneTouchEvent.getMotionEvent();

    final int action = motionEvent.getAction() & MotionEvent.ACTION_MASK;

    switch (action) {
      case MotionEvent.ACTION_POINTER_DOWN:
        if (!this.mPinchZooming && PinchZoomDetector.hasTwoOrMorePointers(motionEvent)) {
          this.mInitialDistance = PinchZoomDetector.calculatePointerDistance(motionEvent);
          this.mCurrentDistance = this.mInitialDistance;
          if (this.mInitialDistance
              > PinchZoomDetector.TRIGGER_PINCHZOOM_MINIMUM_DISTANCE_DEFAULT) {
            this.mPinchZooming = true;
            this.mPinchZoomDetectorListener.onPinchZoomStarted(this, pSceneTouchEvent);
          }
        }
        break;
      case MotionEvent.ACTION_CANCEL:
      case MotionEvent.ACTION_UP:
      case MotionEvent.ACTION_POINTER_UP:
        if (this.mPinchZooming) {
          this.mPinchZooming = false;
          this.mPinchZoomDetectorListener.onPinchZoomFinished(
              this, pSceneTouchEvent, this.getZoomFactor());
        }
        break;
      case MotionEvent.ACTION_MOVE:
        if (this.mPinchZooming) {
          if (PinchZoomDetector.hasTwoOrMorePointers(motionEvent)) {
            this.mCurrentDistance = PinchZoomDetector.calculatePointerDistance(motionEvent);
            if (this.mCurrentDistance
                > PinchZoomDetector.TRIGGER_PINCHZOOM_MINIMUM_DISTANCE_DEFAULT) {
              this.mPinchZoomDetectorListener.onPinchZoom(
                  this, pSceneTouchEvent, this.getZoomFactor());
            }
          } else {
            this.mPinchZooming = false;
            this.mPinchZoomDetectorListener.onPinchZoomFinished(
                this, pSceneTouchEvent, this.getZoomFactor());
          }
        }
        break;
    }
    return true;
  }