コード例 #1
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
 public void playDangerAnimation(float dt) {
   countForDangerAnimation++;
   if (countForDangerAnimation == 1)
     SoundEngine.sharedEngine().playEffect(GameActivity.ctxt, R.raw.effect_danger);
   if (countForDangerAnimation <= 8) danger.setVisible(!danger.getVisible());
   bg_danger.setVisible(!bg_danger.getVisible());
 }
コード例 #2
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  public void runAfterDamagedAnimation_mine(Object o) {
    CCCallFuncN returnToNormalMode = CCCallFuncN.action(this, "returnToNormalMode");
    CCSequence damagedAndReturnToNormal_mine =
        CCSequence.actions(damagedAnimate_mine, returnToNormalMode);

    myCharacter_normal.setVisible(false);
    this.addChild(myCharacter_hurted, 1, ACTION_DAMAGED_MINE);
    myCharacter_hurted.runAction(damagedAndReturnToNormal_mine);
  }
コード例 #3
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  public void runAfterDamagedAnimation_opponent(Object o) {
    opponentCharacter_normal.setVisible(false);
    this.addChild(opponentCharacter_hurted, 1, ACTION_DAMAGED_OPPONENT);
    CCCallFuncN returnToNormalMode = CCCallFuncN.action(this, "returnToNormalMode");
    CCSequence damagedAndReturnToNormal_opponent =
        CCSequence.actions(damagedAnimate_opponent, returnToNormalMode);

    opponentCharacter_hurted.runAction(damagedAndReturnToNormal_opponent);
    /////////////////////////////
  }
コード例 #4
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  public void returnToNormalMode(Object o) {
    updateHPBar();

    int mine, opponent;
    for (mine = 0; mine < numOfCurrentActions_mine; mine++) {
      this.removeChildByTag(ACTION_FLYING_MINE, true);
      this.removeChildByTag(ACTION_DAMAGED_OPPONENT, true);
      this.removeChildByTag(ACTION_ATTACK_MINE, true);
    }
    for (int j = 0; j < mine; j++) numOfCurrentActions_mine--;

    for (opponent = 0; opponent < numOfCurrentActions_opponent; opponent++) {
      this.removeChildByTag(ACTION_FLYING_OPPONENT, true);
      this.removeChildByTag(ACTION_DAMAGED_MINE, true);
      this.removeChildByTag(ACTION_ATTACK_OPPONENT, true);
    }
    for (int j = 0; j < opponent; j++) numOfCurrentActions_opponent--;
    myCharacter_normal.setVisible(true);
    opponentCharacter_normal.setVisible(true);
  }
コード例 #5
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  public void runAttackAnimation_opponent(int kindOfAttack) {
    SoundEngine.sharedEngine().playEffect(GameActivity.ctxt, R.raw.effect_punch);

    numOfCurrentActions_opponent++;

    CCFiniteTimeAction damagedAction = makeDamagedAction();
    CCSequence opponent_attack_sequence = makeMyDamagedSequence(damagedAction);

    opponentCharacter_normal.stopAction(normalAnimate_opponent);
    opponentCharacter_normal.setVisible(false);
    switch (kindOfAttack) {
      case 1:
        SoundEngine.sharedEngine().playEffect(GameActivity.ctxt, R.raw.effect_bark);

        opponentCharacter_normal.setVisible(false);

        this.addChild(attack_bark_opponent, 1, ACTION_ATTACK_OPPONENT);

        coming_bark.setPosition(495 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(coming_bark, 500, ACTION_FLYING_OPPONENT);
        coming_bark.runAction(opponent_attack_sequence);
        break;
      case 2:
        opponentCharacter_normal.setVisible(false);
        this.addChild(attack_bone_opponent, 1, ACTION_ATTACK_OPPONENT);

        coming_bone.setPosition(495 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(coming_bone, 500, ACTION_FLYING_OPPONENT);
        coming_bone.runAction(opponent_attack_sequence);
        break;
      case 3:
        opponentCharacter_normal.setVisible(false);
        this.addChild(attack_punch_opponent, 1, ACTION_ATTACK_OPPONENT);

        coming_punch.setPosition(495 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(coming_punch, 500, ACTION_FLYING_OPPONENT);
        coming_punch.runAction(opponent_attack_sequence);
        break;
    }
  }
コード例 #6
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  public void runAttackAnimation_mine(int kindOfAttack) {
    SoundEngine.sharedEngine().playEffect(GameActivity.ctxt, R.raw.effect_punch);

    numOfCurrentActions_mine++;

    CCFiniteTimeAction attackAction = makeAttackAction();
    CCSequence my_attack_sequence = makeMyAttackSequence(attackAction);

    myCharacter_normal.stopAction(normalAnimate_mine);
    myCharacter_normal.setVisible(false);
    switch (kindOfAttack) {
      case 1:
        SoundEngine.sharedEngine().playEffect(GameActivity.ctxt, R.raw.effect_bark);

        myCharacter_normal.setVisible(false);
        this.addChild(attack_bark_mine, 1, ACTION_ATTACK_MINE);
        going_bark.setPosition(225 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(going_bark, 500, ACTION_FLYING_MINE);
        going_bark.runAction(my_attack_sequence);
        break;
      case 2:
        myCharacter_normal.setVisible(false);
        this.addChild(attack_bone_mine, 1, ACTION_ATTACK_MINE);

        going_bone.setPosition(225 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(going_bone, 500, ACTION_FLYING_MINE);
        going_bone.runAction(my_attack_sequence);
        break;
      case 3:
        myCharacter_normal.setVisible(false);
        this.addChild(attack_punch_mine, 1, ACTION_ATTACK_MINE);

        going_punch.setPosition(225 * Manager.ratio_width, 1030 * Manager.ratio_height);
        this.addChild(going_punch, 500, ACTION_FLYING_MINE);
        going_punch.runAction(my_attack_sequence);
        break;
    }
  }
コード例 #7
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
 /*
  * ��ų ��ư�� Ȱ��, ��Ȱ�� ���� ������Ʈ
  */
 public static void updateSkillBtns() {
   // ��ų ��ư Ȱ��ȭ ==> normal image�� visibility��  false��
   if (gage >= Manager.required_gage_for_skill_punch) {
     btn_skill_bark_normal.setVisible(false);
     btn_skill_bone_normal.setVisible(false);
     btn_skill_punch_normal.setVisible(false);
   } else if (gage >= Manager.required_gage_for_skill_bone) {
     btn_skill_bark_normal.setVisible(false);
     btn_skill_bone_normal.setVisible(false);
     btn_skill_punch_normal.setVisible(true);
   } else if (gage >= Manager.required_gage_for_skill_bark) {
     btn_skill_bark_normal.setVisible(false);
     btn_skill_bone_normal.setVisible(true);
     btn_skill_punch_normal.setVisible(true);
   } else {
     btn_skill_bark_normal.setVisible(true);
     btn_skill_bone_normal.setVisible(true);
     btn_skill_punch_normal.setVisible(true);
   }
 }
コード例 #8
0
ファイル: BattleLayer.java プロジェクト: tae1560/battler_dog
  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);
  }