Пример #1
0
  @Override
  public void update(int delta) {
    if (!active) {
      return;
    }

    // calculate x
    x = entity.getX() - (Globals.APP_WIDTH / 2);
    if (x < 0) {
      x = 0;
    }
    if (x >= Engine.getMap().getWidth() - Globals.APP_WIDTH) {
      x = Engine.getMap().getWidth() - Globals.APP_WIDTH;
    }

    // calculate y
    y = entity.getY() - (Globals.APP_HEIGHT / 2);
    if (y < 0) {
      y = 0;
    }
    if (y >= Engine.getMap().getHeight() - Globals.APP_HEIGHT) {
      y = Engine.getMap().getHeight() - Globals.APP_HEIGHT;
    }

    // play the queued effect if there is one
    if (nextEffect != null) {
      if (!nextEffect.isFinished()) {
        nextEffect.update(delta);
      } else {
        nextEffect = null;
      }
    }
  }
Пример #2
0
 public void playEffect(AbstractCameraEffect effect) {
   nextEffect = effect;
   nextEffect.setCamera(this);
 }