示例#1
0
  public EpisodeLayer() {
    this.setIsTouchEnabled(true);

    bg_episode = CCSprite.sprite("episode/bg_episode.png");
    bg_episode.setScaleX(Manager.ratio_width);
    bg_episode.setScaleY(Manager.ratio_height);
    bg_episode.setPosition(360 * Manager.ratio_width, 720 * Manager.ratio_height);
    this.addChild(bg_episode);

    moveToRight = CCMoveBy.action(5f, CGPoint.ccp(-720f * Manager.ratio_width, 0));
    moveToLeft = CCMoveBy.action(5f, CGPoint.ccp(720f * Manager.ratio_width, 0));
    moveOfCloudSequence = CCSequence.actions(moveToRight, moveToLeft);

    cloud = CCSprite.sprite("episode/cloud.png");
    cloud.setScaleX(Manager.ratio_width);
    cloud.setScaleY(Manager.ratio_height);
    cloud.setPosition(720 * Manager.ratio_width, 1033 * Manager.ratio_height);
    cloud.runAction(CCRepeatForever.action(moveOfCloudSequence));
    this.addChild(cloud);

    episodeList = new CCSprite[9];

    for (int i = 0; i < 9; i++) {
      episodeList[i] = CCSprite.sprite(String.format("episode/episode%d.png", i + 1));
      episodeList[i].setScaleX(Manager.ratio_width);
      episodeList[i].setScaleY(Manager.ratio_height);
      if (i >= 6) episodeList[i].setPosition(360 * Manager.ratio_width, 640 * Manager.ratio_height);
      else episodeList[i].setPosition(360 * Manager.ratio_width, 793 * Manager.ratio_height);
      episodeList[i].setVisible(false);
      this.addChild(episodeList[i]);
    }
    episodeList[currentPageNum].setVisible(true);

    bg_episode = CCSprite.sprite("episode/bg_episode.png");

    btn_next_clicked = CCSprite.sprite("episode/btn_next_clicked.png");
    btn_next_unclicked = CCSprite.sprite("episode/btn_next_unclicked.png");

    btn_next = CCMenuItemSprite.item(btn_next_unclicked, btn_next_clicked, this, "updatePage");
    menu_next = CCMenu.menu(btn_next);
    menu_next.setAnchorPoint(0f, 0f);
    menu_next.setPosition(585 * Manager.ratio_width, 1200 * Manager.ratio_height);
    menu_next.setScaleX(Manager.ratio_width);
    menu_next.setScaleY(Manager.ratio_height);
    this.addChild(menu_next);

    btn_skip_clicked = CCSprite.sprite("episode/btn_skip_clicked.png");
    btn_skip_unclicked = CCSprite.sprite("episode/btn_skip_unclicked.png");
    btn_skip = CCMenuItemSprite.item(btn_skip_unclicked, btn_skip_clicked, this, "clickedSkip");
    menu_skip = CCMenu.menu(btn_skip);
    menu_skip.setAnchorPoint(0f, 0f);
    menu_skip.setPosition(136 * Manager.ratio_width, 1200 * Manager.ratio_height);
    menu_skip.setScaleX(Manager.ratio_width);
    menu_skip.setScaleY(Manager.ratio_height);
    this.addChild(menu_skip);
  }
示例#2
0
  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);
  }
示例#3
0
  public BattleLayer() {
    this.setIsTouchEnabled(true);

    btn_skill_bark_activated = CCSprite.sprite("minigame/btn_skill_bark_activated.png");
    btn_skill_bark_normal = CCSprite.sprite("minigame/btn_skill_bark_normal.png");
    btn_skill_bone_activated = CCSprite.sprite("minigame/btn_skill_bone_activated.png");
    btn_skill_bone_normal = CCSprite.sprite("minigame/btn_skill_bone_normal.png");
    btn_skill_punch_activated = CCSprite.sprite("minigame/btn_skill_punch_activated.png");
    btn_skill_punch_normal = CCSprite.sprite("minigame/btn_skill_punch_normal.png");

    gage_bar = CCSprite.sprite("minigame/gage_bar.png");
    gage_bar_black = CCSprite.sprite("minigame/bg_gage_bar.png");

    init_statics();
    init_states();

    gage_bar.setPosition(86 * Manager.ratio_width, 570 * Manager.ratio_height);
    gage_bar.setScaleX(Manager.ratio_width);
    gage_bar.setScaleY(Manager.ratio_height);
    this.addChild(gage_bar);

    gage_bar_black.setPosition(85 * Manager.ratio_width, 765 * Manager.ratio_height);
    gage_bar_black.setAnchorPoint(0.5f, 1f);
    gage_bar_black.setScaleX(Manager.ratio_width);
    gage_bar_black.setScaleY(1 - gage / Manager.full_gage);
    gage_bar_black.setScaleY(Manager.ratio_height);
    this.addChild(gage_bar_black);

    // ��ų ��ư ��ġ ����, ���̾ �߰�
    btn_skill_bark_activated.setPosition(631 * Manager.ratio_width, 733 * Manager.ratio_height);
    btn_skill_bark_activated.setScaleX(Manager.ratio_width); // * Ȯ�� �ʿ�
    btn_skill_bark_activated.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_bark_activated);
    btn_skill_bark_normal.setPosition(631 * Manager.ratio_width, 733 * Manager.ratio_height);
    btn_skill_bark_normal.setScaleX(Manager.ratio_width); // * Ȯ�� �ʿ�
    btn_skill_bark_normal.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_bark_normal);

    btn_skill_bone_activated.setPosition(631 * Manager.ratio_width, 589 * Manager.ratio_height);
    btn_skill_bone_activated.setScaleX(Manager.ratio_width);
    btn_skill_bone_activated.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_bone_activated);
    btn_skill_bone_normal.setPosition(631 * Manager.ratio_width, 589 * Manager.ratio_height);
    btn_skill_bone_normal.setScaleX(Manager.ratio_width);
    btn_skill_bone_normal.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_bone_normal);

    btn_skill_punch_activated.setPosition(631 * Manager.ratio_width, 439 * Manager.ratio_height);
    btn_skill_punch_activated.setScaleX(Manager.ratio_width);
    btn_skill_punch_activated.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_punch_activated);
    btn_skill_punch_normal.setPosition(631 * Manager.ratio_width, 439 * Manager.ratio_height);
    btn_skill_punch_normal.setScaleX(Manager.ratio_width);
    btn_skill_punch_normal.setScaleY(Manager.ratio_height);
    this.addChild(btn_skill_punch_normal);

    ////////////////////////////////////////////////////////////////////////////
    bg_battlelayer.setPosition(360 * Manager.ratio_width, 1057 * Manager.ratio_height);
    bg_battlelayer.setScaleX(Manager.ratio_width);
    bg_battlelayer.setScaleY(Manager.ratio_height);
    this.addChild(bg_battlelayer);

    makeNormalAnimation();
    makeDemagedAnimation();

    myCharacter_normal =
        CCSprite.sprite(
            String.format("character/char%d_normal1.png", CurrentUserInformation.userChar));
    myCharacter_normal.setScaleX(-1 * Manager.ratio_width);
    myCharacter_normal.setScaleY(Manager.ratio_height);
    myCharacter_normal.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);
    myCharacter_normal.runAction(CCRepeatForever.action(normalAnimate_mine));
    this.addChild(myCharacter_normal);

    opponentCharacter_normal =
        CCSprite.sprite(
            String.format("character/char%d_normal1.png", CurrentUserInformation.opponentchar));
    opponentCharacter_normal.setScaleX(Manager.ratio_width);
    opponentCharacter_normal.setScaleY(Manager.ratio_height);
    opponentCharacter_normal.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);
    opponentCharacter_normal.runAction(CCRepeatForever.action(normalAnimate_opponent));
    this.addChild(opponentCharacter_normal);

    myCharacter_hurted =
        CCSprite.sprite(
            String.format("character/char%d_hurted1.png", CurrentUserInformation.userChar));
    myCharacter_hurted.setScaleX(-1 * Manager.ratio_width);
    myCharacter_hurted.setScaleY(Manager.ratio_height);
    myCharacter_hurted.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);

    opponentCharacter_hurted =
        CCSprite.sprite(
            String.format("character/char%d_hurted1.png", CurrentUserInformation.opponentchar));
    opponentCharacter_hurted.setScaleX(Manager.ratio_width);
    opponentCharacter_hurted.setScaleY(Manager.ratio_height);
    opponentCharacter_hurted.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);

    bg_hp_bar.setPosition(360 * Manager.ratio_width, 1240 * Manager.ratio_height);
    bg_hp_bar.setScaleX(-1 * Manager.ratio_width);
    bg_hp_bar.setScaleY(Manager.ratio_height);
    this.addChild(bg_hp_bar);

    hp_bar_mine.setPosition(321 * Manager.ratio_width, 1240 * Manager.ratio_height);
    hp_bar_mine.setScaleX(Manager.ratio_width);
    hp_bar_mine.setScaleY(Manager.ratio_height);
    hp_bar_mine.setAnchorPoint(1f, 0.5f);
    this.addChild(hp_bar_mine);

    hp_bar_opponent.setPosition(400 * Manager.ratio_width, 1240 * Manager.ratio_height);
    hp_bar_opponent.setScaleX(Manager.ratio_width);
    hp_bar_opponent.setScaleY(Manager.ratio_height);
    hp_bar_opponent.setAnchorPoint(0f, 0.5f);
    this.addChild(hp_bar_opponent);

    title.setPosition(360 * Manager.ratio_width, 1235 * Manager.ratio_height);
    title.setScaleX(Manager.ratio_width);
    title.setScaleY(Manager.ratio_height);
    this.addChild(title);

    attack_bark_opponent =
        CCSprite.sprite(
            String.format("character/attack_bark%d.png", CurrentUserInformation.opponentchar));
    attack_bark_opponent.setScaleX(Manager.ratio_width);
    attack_bark_opponent.setScaleY(Manager.ratio_height);
    attack_bark_opponent.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);
    attack_bark_mine =
        CCSprite.sprite(
            String.format("character/attack_bark%d.png", CurrentUserInformation.userChar));
    attack_bark_mine.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);
    attack_bark_mine.setScaleX(-1 * Manager.ratio_width);
    attack_bark_mine.setScaleY(Manager.ratio_height);

    attack_bone_opponent =
        CCSprite.sprite(
            String.format("character/attack_bone%d.png", CurrentUserInformation.opponentchar));
    attack_bone_opponent.setScaleX(Manager.ratio_width);
    attack_bone_opponent.setScaleY(Manager.ratio_height);
    attack_bone_opponent.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);
    attack_bone_mine =
        CCSprite.sprite(
            String.format("character/attack_bone%d.png", CurrentUserInformation.userChar));
    attack_bone_mine.setScaleX(-1 * Manager.ratio_width);
    attack_bone_mine.setScaleY(Manager.ratio_height);
    attack_bone_mine.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);

    attack_punch_opponent =
        CCSprite.sprite(
            String.format("character/attack_punch%d.png", CurrentUserInformation.opponentchar));
    attack_punch_opponent.setScaleX(Manager.ratio_width);
    attack_punch_opponent.setScaleY(Manager.ratio_height);
    attack_punch_opponent.setPosition(508 * Manager.ratio_width, 1019 * Manager.ratio_height);
    attack_punch_mine =
        CCSprite.sprite(
            String.format("character/attack_punch%d.png", CurrentUserInformation.userChar));
    attack_punch_mine.setScaleX(-1 * Manager.ratio_width);
    attack_punch_mine.setScaleY(Manager.ratio_height);
    attack_punch_mine.setPosition(212 * Manager.ratio_width, 1019 * Manager.ratio_height);

    coming_bark = CCSprite.sprite("battle/coming_bark.png");
    coming_bark.setScaleX(Manager.ratio_width);
    coming_bark.setScaleY(Manager.ratio_height);
    going_bark = CCSprite.sprite("battle/coming_bark.png");
    going_bark.setScaleX(-1 * Manager.ratio_width);
    going_bark.setScaleY(Manager.ratio_height);

    coming_bone = CCSprite.sprite("battle/coming_bone.png");
    coming_bone.setScaleX(Manager.ratio_width);
    coming_bone.setScaleY(Manager.ratio_height);

    going_bone = CCSprite.sprite("battle/coming_bone.png");
    going_bone.setScaleX(-1 * Manager.ratio_width);
    going_bone.setScaleY(Manager.ratio_height);

    coming_punch = CCSprite.sprite("battle/coming_punch.png");
    coming_punch.setScaleX(Manager.ratio_width);
    coming_punch.setScaleY(Manager.ratio_height);

    going_punch = CCSprite.sprite("battle/coming_punch.png");
    going_punch.setScaleX(-1 * Manager.ratio_width);
    going_punch.setScaleY(Manager.ratio_height);

    danger = CCSprite.sprite("minigame/danger.png");
    danger.setScaleX(Manager.ratio_width);
    danger.setScaleY(Manager.ratio_height);
    danger.setPosition(360 * Manager.ratio_width, 833 * Manager.ratio_height);
    danger.setVisible(false);
    this.addChild(danger);

    bg_danger = CCSprite.sprite("minigame/bg_danger.png");
    bg_danger.setScaleX(Manager.ratio_width);
    bg_danger.setScaleY(Manager.ratio_height);
    bg_danger.setPosition(360 * Manager.ratio_width, 640 * Manager.ratio_height);
    bg_danger.setVisible(false);
    this.addChild(bg_danger);

    CCFiniteTimeAction action_waitFight =
        CCMoveTo.action(2f, CGPoint.ccp(-360 * Manager.ratio_width, 826 * Manager.ratio_height));
    CCFiniteTimeAction action_incomingFight =
        CCMoveTo.action(0.3f, CGPoint.ccp(360 * Manager.ratio_width, 826 * Manager.ratio_height));
    CCFiniteTimeAction action_delayFight =
        CCMoveTo.action(0.5f, CGPoint.ccp(360 * Manager.ratio_width, 826 * Manager.ratio_height));
    CCFiniteTimeAction action_outgoingFight =
        CCMoveTo.action(0.3f, CGPoint.ccp(1080 * Manager.ratio_width, 826 * Manager.ratio_height));
    CCCallFuncN tellFight = CCCallFuncN.action(this, "tellFight");
    CCCallFuncN removeFight = CCCallFuncN.action(this, "removeFight");

    CCSequence sequence_fight =
        CCSequence.actions(
            action_waitFight,
            tellFight,
            action_incomingFight,
            action_delayFight,
            action_outgoingFight,
            removeFight);
    fight = CCSprite.sprite("minigame/fight.png");
    fight.setPosition(-360, 826);
    fight.setScaleX(Manager.ratio_width);
    fight.setScaleY(Manager.ratio_height);
    fight.runAction(sequence_fight);
    this.addChild(fight);

    NetworkManager.getInstance().setGetDamagedCallback(this);
  }