Beispiel #1
0
 public void updateHPBar() {
   hp_bar_mine.setScaleX(hp_mine / Manager.full_hp * Manager.ratio_width);
   hp_bar_opponent.setScaleX(hp_opponent / Manager.full_hp * Manager.ratio_width);
   if (hp_mine < Manager.thresholdOfHP && countForDangerAnimation == 0) {
     this.schedule("playDangerAnimation", 0.5f);
   }
 }
Beispiel #2
0
 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());
 }
Beispiel #3
0
  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);
  }
Beispiel #4
0
 public void setDirtyRecursively(boolean b) {
   dirty_ = recursiveDirty_ = b;
   // recursively set dirty
   if (hasChildren_) {
     for (CCNode child : children_) {
       CCSprite sprite = (CCSprite) child;
       sprite.setDirtyRecursively(true);
     }
   }
 }
  /** 播放序列帧,,开始游戏 */
  private void ready() {
    ready = CCSprite.sprite("image/fight/startready_01.png");

    ArrayList<CCSpriteFrame> frames = null;
    ready.setPosition(winSize.getWidth() / 2, winSize.getHeight() / 2);
    this.addChild(ready);
    CCAnimate animate = CommonUtil.getAnimate(frames, 3, "image/fight/startready_%02d.png");
    CCSequence sequence = CCSequence.actions(animate, CCCallFunc.action(this, "go"));
    ready.runAction(sequence);
  }
Beispiel #6
0
  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);
    /////////////////////////////
  }
Beispiel #7
0
  public ShowPlant(int id) {
    this.id = id;
    HashMap<String, String> hashMap = plants.get(id);
    String path = hashMap.get("path");
    showSprite = CCSprite.sprite(path);
    showSprite.setAnchorPoint(0, 0);

    bgSprite = CCSprite.sprite(path);
    bgSprite.setOpacity(100); // 给背景精灵设置透明度
    bgSprite.setAnchorPoint(0, 0);
  }
 public void changeColor(float dt) {
   CGSize winSize = CCDirector.sharedDirector().displaySize();
   removeChild(light, true);
   if (isRed) {
     light = CCSprite.sprite("greenlight.png");
     isRed = false;
   } else {
     light = CCSprite.sprite("redlight.png");
     isRed = true;
   }
   warning = 0;
   light.setPosition(CGPoint.ccp(winSize.width - 50, 100));
   addChild(light);
 }
  // MOSTRA IMAGENS[]
  private void mostra(int i, CGPoint pos) {

    this.imagens[i].setVisible(false);
    this.imagens[i] = CCSprite.sprite(retornoCategoria[i]);
    this.imagens[i].setPosition(pos);
    addChild(imagens[i]);
  }
  // esconde a figura e seta a pergunta
  private void esconde(int i, CGPoint pos) {

    this.imagens[i].setVisible(false);
    this.imagens[i] = CCSprite.sprite("Question.png");
    this.imagens[i].setPosition(pos);
    addChild(imagens[i]);
  }
  protected RGLightLayer(ccColor4B color) {
    super(color);
    this.setIsTouchEnabled(true);
    CGSize winSize = CCDirector.sharedDirector().displaySize();

    warning = 0;
    isMoving = false;
    isRed = true;

    _player = CCSprite.sprite("light_runner.png");
    _player.setPosition(CGPoint.ccp(_player.getContentSize().width / 2.0f, 75));

    background = CCSprite.sprite("backyard_bg.png");
    // background.setTag(1);
    background.setAnchorPoint(0, 0);
    addChild(background);

    light = CCSprite.sprite("redlight.png");
    light.setPosition(CGPoint.ccp(winSize.width - 50, 100));
    a = Account.getInstance();
    // this.act=act;

    addChild(light);
    addChild(_player);
    schedule("checkFinished");
    schedule("movePlayer");
    schedule("changeColor", 1.5F);
  }
Beispiel #12
0
  /** 开启游戏前的准备 */
  private void preGame() {

    // 1.回收容器
    chooseContainer.removeSelf();

    // 玩家已有植物容器进行缩放(包含所有已经选择的植物信息)
    choseContainer.setScale(0.65f);

    // 用已选择的植物填充容器,对容器做缩放操作
    for (ShowPlant item : chosePlantList) {
      CCSprite sprite = item.getDefaultImg();
      CGPoint pos =
          CGPoint.ccp(
              sprite.getPosition().x * 0.65f,
              sprite.getPosition().y + (winSize.getHeight() - sprite.getPosition().y) * 0.35f);
      sprite.setPosition(pos);
      sprite.setScale(0.65f);
      this.addChild(sprite);
    }

    // 2.移动地图
    CGPoint pos =
        CGPoint.ccp(
            gameMap.getContentSize().getWidth() / 2, gameMap.getContentSize().getHeight() / 2);
    CCMoveTo moveTo = CCMoveTo.action(1, pos);
    gameMap.runAction(moveTo);

    CCSequence sequence = CCSequence.actions(moveTo, CCCallFunc.action(this, "clearZombies"));
    // 3.回收僵尸
    gameMap.runAction(sequence);
  }
 private void refreshAnswers() {
   for (CCNode node : floatingSprites) {
     if (node.getTag() >= kTagAnswerBg) {
       CCSprite sprite = (CCSprite) node;
       int _answeringIdx = sprite.getTag() - kTagAnswerBg;
       if (_answeringIdx == answeringIndex) {
         sprite.setColor(ccColor3B.ccWHITE);
       } else {
         sprite.setColor(ccColor3B.ccGRAY);
       }
       CCLabel label = (CCLabel) sprite.getUserData();
       if (answer_of_item_each_type[_answeringIdx] >= 0) {
         label.setString("" + answer_of_item_each_type[_answeringIdx]);
       } else {
         label.setString("?");
       }
     }
   }
 }
  public void buttonClicked(CCSprite sender) {

    // inicio da verificação
    for (int i = 0; i < imagens.length; i++) {
      // indentifica qual foi o botao clicado do meu vetor
      if (sender.equals(imagens[i])) {

        // primeira jogada
        if (ultimoBotaoClicado == -1) {

          this.primeiraPosicao = imagens[i].getPosition();
          mostra(i, primeiraPosicao);
          ultimoBotaoClicado = i;
        }
        // segunda jogada
        else if (retornoCategoria[i] == retornoCategoria[ultimoBotaoClicado]) {
          quantBotoesClicados += 2;
          this.segundaPosicao = imagens[i].getPosition();
          mostra(i, segundaPosicao);
          ToastManager.show(
              CCDirector.sharedDirector().getActivity(),
              retornoCategoria[i].toString().substring(0, retornoCategoria[i].length() - 4),
              ToastManager.SUCESS);
          ultimoBotaoClicado = -1;
          delegate.score.acrecenta();
          verificaFinalDoJogo();
          // desabilita o touch da imagem
        } else {

          this.segundaPosicao = imagens[i].getPosition();
          mostra(i, segundaPosicao);
          x = i;
          this.setIsTouchEnabled(false);
          // executarTempo(2000);
          Runnable run =
              new Runnable() {
                @Override
                public void run() {
                  esconde(ultimoBotaoClicado, primeiraPosicao);
                  esconde(x, imagens[x].getPosition());
                  ToastManager.show(
                      CCDirector.sharedDirector().getActivity(), " Ops :(", ToastManager.ERROR);
                  ultimoBotaoClicado = -1;
                  primeiraPosicao = null;
                  segundaPosicao = null;
                  delegate.score.tira();
                  setIsTouchEnabled(true);
                }
              };
          // tempo de 1 segundos
          tempo.schedule(run, 1, TimeUnit.SECONDS);
        }
      }
    }
  }
Beispiel #15
0
  /** 开始游戏 */
  public void go() {

    // 开始游戏前,移除序列帧
    ready.removeSelf();

    // 开始游戏后,屏幕可点击
    setIsTouchEnabled(true);

    // 游戏业务处理
    GameController.getInstance().start(gameMap, chosePlantList);
  }
 public void checkFinished(float dt) {
   CGPoint playerPos = _player.getPosition();
   CGSize winSize = CCDirector.sharedDirector().displaySize();
   background.setContentSize(winSize.width, winSize.height);
   if (isMoving && isRed && warning == 1) {
     Log.d("checkFinished", "Player Loses");
     a.decScore();
     ActivityAccesser.getInstance().setCompWin(true);
     ActivityAccesser.getInstance().setPlayedGame(true);
     rlActivity.finish();
   } else if (isMoving && isRed && warning == 1) {
     warning++;
   } else if (playerPos.x >= (winSize.width - 50)) {
     Log.d("checkFinished", "Player Wins");
     a.incScore();
     ActivityAccesser.getInstance().setCompWin(false);
     ActivityAccesser.getInstance().setPlayedGame(true);
     rlActivity.finish();
   }
 }
 public void movePlayer(float dt) {
   ActivityAccesser a = ActivityAccesser.getInstance();
   float curr = a.getValues();
   float distance = curr - prev;
   // Log.d("Curr",curr+"");
   // Log.d("Prev",prev+"");
   // Log.d("Distance",distance+"");
   if (prev == 0) {
     prev = curr;
     return;
   }
   prev = curr;
   if (Math.abs(distance) > 2) {
     CGPoint playerPos = _player.getPosition();
     // Log.d("x",playerPos.x+"");
     CGPoint newPoint = CGPoint.ccp(playerPos.x + Math.abs(distance), playerPos.y);
     _player.setPosition(newPoint);
     isMoving = true;
   } else isMoving = false;
 }
Beispiel #18
0
  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);
  }
Beispiel #19
0
  private void makeGround() {
    Bitmap bitmap = FronBitmapMaker.getInstance().loadBitmap(R.drawable.land_03_line);
    Bitmap target =
        Bitmap.createBitmap(
            60 * ServerData.mapSize, 30 * ServerData.mapSize + 20, Config.ARGB_8888);
    Canvas can = new Canvas(target);
    CGPoint pt;
    for (int i = 0; i < ServerData.mapSize; i++) {
      for (int j = 0; j < ServerData.mapSize; j++) {
        pt = FronUtil.isoToScreen(CGPoint.ccp(i, j));
        //				Log.i("position", pt.x+","+pt.y);
        can.drawBitmap(bitmap, pt.x + ((ServerData.mapSize - 1) * 30), pt.y, null);
      }
    }
    CCSprite ground = new CCSprite(target, "land_03");
    ground.setPosition(0, -(ServerData.mapSize * 15));
    addChild(ground);

    this.setPosition(400, 300);
    bitmap.recycle();
  }
Beispiel #20
0
 @Override
 public boolean ccTouchesBegan(MotionEvent event) {
   CGPoint touchPoint =
       CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
   if (btn_skill_bark_normal.getBoundingBox().contains(touchPoint.x, touchPoint.y)
       && gage >= Manager.required_gage_for_skill_bark) {
     SoundEngine.sharedEngine()
         .playEffect(CCDirector.sharedDirector().getActivity(), R.raw.effect_button);
     gage -= Manager.required_gage_for_skill_bark;
     hp_opponent -= Manager.damaged_hp_per_attack_bark;
     updateSkillBtns();
     updateGageBar();
     runAttackAnimation_mine(1);
     NetworkManager.getInstance().sendAttack(SkillType.BARK);
   } else if (btn_skill_bone_normal.getBoundingBox().contains(touchPoint.x, touchPoint.y)
       && gage >= Manager.required_gage_for_skill_bone) {
     SoundEngine.sharedEngine()
         .playEffect(CCDirector.sharedDirector().getActivity(), R.raw.effect_button);
     gage -= Manager.required_gage_for_skill_bone;
     hp_opponent -= Manager.damaged_hp_per_attack_bone;
     updateSkillBtns();
     updateGageBar();
     runAttackAnimation_mine(2);
     NetworkManager.getInstance().sendAttack(SkillType.BONE);
     /// * �������� ��� ���� ���
   } else if (btn_skill_punch_normal.getBoundingBox().contains(touchPoint.x, touchPoint.y)
       && gage >= Manager.required_gage_for_skill_punch) {
     SoundEngine.sharedEngine()
         .playEffect(CCDirector.sharedDirector().getActivity(), R.raw.effect_button);
     gage -= Manager.required_gage_for_skill_punch;
     hp_opponent -= Manager.damaged_hp_per_attack_punch;
     updateSkillBtns();
     updateGageBar();
     runAttackAnimation_mine(3);
     NetworkManager.getInstance().sendAttack(SkillType.PUNCH);
     /// * �������� ��� ���� ���
   }
   return super.ccTouchesBegan(event);
 }
Beispiel #21
0
  /** 显示容器 */
  public void loadContainer() {
    chooseContainer = CCSprite.sprite("image/fight/chose/fight_choose.png");
    choseContainer = CCSprite.sprite("image/fight/chose/fight_chose.png");

    choseContainer.setAnchorPoint(0, 1);
    choseContainer.setPosition(0, winSize.height);

    chooseContainer.setAnchorPoint(0, 0);
    this.addChild(choseContainer, 0, TAG_CHOSE); // 第二个参数,0,1表示优先级
    this.addChild(chooseContainer, 1);

    // 加载植物信息
    loadPlant();

    // 添加开始图片
    start = CCSprite.sprite("image/fight/chose/fight_start.png");
    start.setPosition(chooseContainer.getContentSize().getWidth() / 2, 40);
    chooseContainer.addChild(start);
  }
Beispiel #22
0
  private void loadPlant() {
    // 展示用的植物信息
    showPlantList = new ArrayList<ShowPlant>();
    // 。。。。
    chosePlantList = new CopyOnWriteArrayList<ShowPlant>();
    for (int i = 1; i <= 9; i++) {

      // 传入ID时就初始化了所以的植物信息
      ShowPlant plant = new ShowPlant(i);
      CCSprite defaultImg = plant.getDefaultImg();
      CCSprite bgImg = plant.getBgImg();
      defaultImg.setPosition((i - 1) % row * 54 + 16, 175 - (i - 1) / row * 59);
      bgImg.setPosition((i - 1) % row * 54 + 16, 175 - (i - 1) / row * 59);
      chooseContainer.addChild(defaultImg);
      chooseContainer.addChild(bgImg);
      showPlantList.add(plant);
    }

    setIsTouchEnabled(true);
  }
Beispiel #23
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 #24
0
 /*
  * �������� �� ������ �� ���� ������Ʈ
  */
 public static void updateGageBar() {
   gage_bar_black.setScaleY((1 - (gage / Manager.full_gage)) * Manager.ratio_height);
 }
Beispiel #25
0
 /*
  * ��ų ��ư�� Ȱ��, ��Ȱ�� ���� ������Ʈ
  */
 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);
   }
 }
Beispiel #26
0
  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;
    }
  }
Beispiel #27
0
  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;
    }
  }
Beispiel #28
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);
  }
Beispiel #29
0
  private void init_statics() {
    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");

    bg_battlelayer = CCSprite.sprite("battle/bg_battlelayer.png");
    bg_hp_bar = CCSprite.sprite("battle/bg_hp_bar.png");
    hp_bar_mine = CCSprite.sprite("battle/hp_bar.png");
    hp_bar_opponent = CCSprite.sprite("battle/hp_bar.png");
    title = CCSprite.sprite("battle/title.png");
  }
Beispiel #30
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);
  }