示例#1
0
文件: Walker.cpp 项目: ourgames/dc208
bool Walker::init(){
    // CCString* filePath = CCString::createWithFormat("%s_%d_%WALKER_S_WAVE_0.png", m_icon.c_str(), m_side, "N");
    CCString* filePath = CCString::createWithFormat("%s_%d_%s_move_0.png", m_icon.c_str(), m_side, m_direct != "SW" ? "N" : "SW"); // guo.jiang
    if(CCLoadSprite::getSF(filePath->getCString())==NULL){
        CCLOG("filePath=%s",filePath->getCString());
    }
    m_shadow = CCLoadSprite::createSprite("walker_shadow.png");
    m_shadow->setAnchorPoint(ccp(0.5, 0.5));
    m_shadow->setOpacity(127);
    m_batchNode->addChild(m_shadow);
    
    m_iconSpr = CCLoadSprite::createSprite(filePath->getCString());
    m_iconSpr->setAnchorPoint(ccp(0.5,0.5));
    m_batchNode->addChild(m_iconSpr);
    //begin a by ljf  //解决造出兵时的遮挡问题
    m_iconSpr->setCameraMask(m_batchNode->getCameraMask(), true);
    //end a by ljf
    changeDirect(m_direct);
    float scale = 0.5;
    if(m_isHead){
        scale = 2;
    }
    m_iconSpr->setScale(scale);
    
    initPath();
    
    
    startMove();
    
    return true;
}
示例#2
0
void CDragon::onEnter()
{
    CBoss::onEnter();

    //---------------------------------------------

    //风魔龙闪电云技能
    T_SkillDragonLighing* skilllight    = new T_SkillDragonLighing();
    skilllight->m_fMaxTime              = 10; //   
    skilllight->init();

    //风魔龙 龙卷风技能
    T_SkillDrogTornado* pSkillTornado   = new T_SkillDrogTornado();
    pSkillTornado->m_fMaxTime           = 120;
    pSkillTornado->m_fMAXWhiteTime      = 3;
    pSkillTornado->m_fMAXBlackTime      = 4;
    pSkillTornado->init();

    //风魔龙 龙卷风技能
    T_RandSkill allRandSkill[] = 
    {
        //{ 3, 0, Skill::SKILL_T_LIGHTING, RandSkill_State::RANDSKILL_STATE_CD, (T_SkillData*)skilllight },
        { 3, 0, Skill::SKILL_T_TORNADO, RandSkill_State::RANDSKILL_STATE_CD, (T_SkillData*)pSkillTornado }
    
    };
    
    int size = sizeof(allRandSkill) / sizeof(allRandSkill[0]);
    for (int i = 0; i < size;i++)
    {
        T_RandSkill* randskill      = new T_RandSkill();

        randskill->m_iMaxCD         = allRandSkill[i].m_iMaxCD;
        randskill->m_iSkillCd       = allRandSkill[i].m_iSkillCd;
        randskill->m_iSkillId       = allRandSkill[i].m_iSkillId;
        randskill->m_iSkillState    = allRandSkill[i].m_iSkillState;
        randskill->m_pSkill         = allRandSkill[i].m_pSkill;

        randskill->init();

        m_oAllRandSkill.push_back(randskill);
    }

    createSkillTimer();
    
    //======================================

    clearCurrentAnimation();    
    setCurrentAnimation(ARMATURE_DRAGON);
    getArmature()->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(CDragon::movementCallback));
    getArmature()->getAnimation()->playByIndex(0);

    //-------------------------------------

    int t_direct    = CPath::DIRECT[CMath::getRandom(0, 3)][0];
    m_iDirect       = t_direct + CMath::getRandom(-30, 30);
    changeDirect(t_direct);
}