Пример #1
0
  public void fadeIn(double duration) {
    // Fade in the main sprite and blob shadow.
    SKAction fadeAction = SKAction.fadeIn(duration);

    setAlpha(0.0);
    runAction(fadeAction);

    shadowBlob.setAlpha(0.0);
    shadowBlob.runAction(fadeAction);
  }
Пример #2
0
  private void init(CGPoint position) {
    SKTextureAtlas atlas = SKTextureAtlas.create("Environment");

    shadowBlob = SKSpriteNode.create(atlas.getTexture("blobShadow.png"));
    shadowBlob.setZPosition(-1.0);

    setPosition(position);

    health = 100.0;
    movementSpeed = MOVEMENT_SPEED;
    animated = true;
    animationSpeed = 1 / 28.0;

    configurePhysicsBody();
  }
Пример #3
0
  public void update(double interval) {
    // Shadow always follows our main sprite.
    shadowBlob.setPosition(getPosition());

    if (animated) {
      resolveRequestedAnimation();
    }
  }
Пример #4
0
 void reset() {
   // Reset some base states (used when recycling character instances).
   health = 100;
   dying = false;
   attacking = false;
   animated = true;
   requestedAnimation = APAAnimationState.Idle;
   shadowBlob.setAlpha(1.0);
 }
Пример #5
0
  private void animationHasCompleted(APAAnimationState animationState) {
    if (dying) {
      animated = false;
      shadowBlob.runAction(SKAction.fadeOut(1.5));
    }

    animationDidComplete(animationState);

    if (attacking) {
      attacking = false;
    }

    activeAnimationKey = null;
  }
Пример #6
0
 @Override
 public void removeFromParent() {
   shadowBlob.removeFromParent();
   super.removeFromParent();
 }
Пример #7
0
  @Override
  public void setAlpha(double alpha) {
    super.setAlpha(alpha);

    shadowBlob.setAlpha(alpha);
  }
Пример #8
0
  @Override
  public void setScale(double scale) {
    super.setScale(scale);

    shadowBlob.setScale(scale);
  }