Beispiel #1
0
  public void makeNormalAnimation() {
    normalAnimation_mine = CCAnimation.animation("animation1", 0.15f);
    for (int i = 2; i <= 5; i++) {
      CCSprite frame =
          CCSprite.sprite(
              String.format("character/char%d_normal%d.png", CurrentUserInformation.userChar, i));
      frame.setScaleX(-1 * Manager.ratio_width);
      frame.setScaleY(Manager.ratio_height);
      frame.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);
      normalAnimation_mine.addFrame(frame.getTexture());
    }
    normalAnimate_mine = CCAnimate.action(normalAnimation_mine, false);

    normalAnimation_opponent = CCAnimation.animation("animation2", 0.15f);
    opponentCharacter_normal =
        CCSprite.sprite(
            String.format("character/char%d_normal1.png", CurrentUserInformation.opponentchar));
    for (int i = 5; i >= 2; i--) {
      CCSprite frame =
          CCSprite.sprite(
              String.format(
                  "character/char%d_normal%d.png", CurrentUserInformation.opponentchar, i));
      frame.setScaleX(Manager.ratio_width);
      frame.setScaleY(Manager.ratio_height);
      frame.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);
      normalAnimation_opponent.addFrame(frame.getTexture());
    }
    normalAnimate_opponent = CCAnimate.action(normalAnimation_opponent, true);
  }
Beispiel #2
0
  public void makeDemagedAnimation() {
    damagedAnimation_mine = CCAnimation.animation("animation5", 0.15f);
    myCharacter_hurted =
        CCSprite.sprite(
            String.format("character/char%d_hurted1.png", CurrentUserInformation.userChar));
    myCharacter_hurted.setPosition(139 * Manager.ratio_width, 1019 * Manager.ratio_height);
    for (int i = 1; i <= 5; i++) {
      CCSprite frame =
          CCSprite.sprite(
              String.format("character/char%d_hurted%d.png", CurrentUserInformation.userChar, i));
      frame.setScaleX(-1 * Manager.ratio_width);
      frame.setScaleY(Manager.ratio_height);
      damagedAnimation_mine.addFrame(frame.getTexture());
    }
    damagedAnimate_mine = CCAnimate.action(damagedAnimation_mine, false);

    damagedAnimation_opponent = CCAnimation.animation("animation6", 0.15f);
    opponentCharacter_hurted =
        CCSprite.sprite(
            String.format("character/char%d_hurted1.png", CurrentUserInformation.opponentchar));
    opponentCharacter_hurted.setPosition(581 * Manager.ratio_width, 1019 * Manager.ratio_height);
    for (int i = 1; i <= 5; i++) {
      CCSprite frame =
          CCSprite.sprite(
              String.format(
                  "character/char%d_hurted%d.png", CurrentUserInformation.opponentchar, i));
      frame.setScaleX(Manager.ratio_width);
      frame.setScaleY(Manager.ratio_height);
      damagedAnimation_opponent.addFrame(frame.getTexture());
    }
    damagedAnimate_opponent = CCAnimate.action(damagedAnimation_opponent, false);
  }
  public void init_animation(String path_anim_file, int start_index, int stop_index) {
    CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames(path_anim_file + ".plist");
    // set png file created with
    CCSpriteSheet spriteSheet = CCSpriteSheet.spriteSheet(path_anim_file + ".png");

    addChild(spriteSheet);
    flag_move = new ArrayList<CCSpriteFrame>();
    for (int i = start_index; i < stop_index; i++)
      flag_move.add(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName(i + ".png"));

    CCAnimation atAnimation = CCAnimation.animation("flag_movie", 0.1f, flag_move);
    CCRepeatForever atAction = CCRepeatForever.action(CCAnimate.action(atAnimation, false));
    this.runAction(atAction);
  }