Пример #1
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);
  }
Пример #2
0
  /** 移动地图 */
  private void moveMap() {

    CGPoint pos =
        CGPoint.ccp(
            gameMap.getPosition().x - (gameMap.getContentSize().getWidth() - winSize.getWidth()),
            gameMap.getPosition().y);
    CCMoveTo moveTo = CCMoveTo.action(1, pos);
    CCSequence sequence =
        CCSequence.actions(
            CCDelayTime.action(1),
            moveTo,
            CCDelayTime.action(0.5f),
            CCCallFunc.action(this, "loadContainer"));
    gameMap.runAction(sequence);
  }