コード例 #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);
  }