// on "init" you need to initialize your instance bool SnowNight::init() { // 1. super init first if ( !CCLayer::init() ) { return false; } this->setKeypadEnabled(true); winSize = CCDirector::sharedDirector()->getWinSize(); // 屏幕大小 //background image bgTexture = CCTextureCache::sharedTextureCache()->addImage("ld_bg_snow_night.jpg"); this->moveBackgroundSprite(NULL); float scale = winSize.width / 320.0f;//缩放比率 因为我是按照320*480设计的粒子效果 CCParticleSystemQuad *snowEffect = CCParticleSystemQuad::create("snow.plist"); snowEffect->setPosition(ccp(winSize.width/2-30, winSize.height)); //rainEffect->setAnchorPoint(Point(0,0)); snowEffect->setScale(scale); this->addChild(snowEffect); if (isPlaySound) { CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic("windy.mp3"); } return true; }
void Issue870::updateQuads(ccTime dt) { m_nIndex = (m_nIndex + 1) % 4; CGRect rect = CGRectMake(m_nIndex * 32, 0, 32, 32); CCParticleSystemQuad* system = (CCParticleSystemQuad*)m_emitter; system->setTextureWithRect(m_emitter->getTexture(), rect); }
//------------------------------------------------------------------------------- // // void CMiniGameCatchLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent) { if( m_bIsHit ) { return; } CCSetIterator it = pTouches->begin(); CCTouch* touch = (CCTouch*)(*it); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCPoint touchLocation = touch->locationInView( touch->view() ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); if( touchLocation.x < m_pPet->getPosition().x ) { m_iPetActionState = MINIGAME_PET_MOVE_LEFT; } else if( touchLocation.x > m_pPet->getPosition().x ) { m_iPetActionState = MINIGAME_PET_MOVE_RIGHT; } m_pPet->PlayAnimation( m_pBaseDataAnimation->m_move, -1, NULL, this, false, false); std::string effectpath = GetGameParticlePath(); std::string filename = effectpath + "touchDownEffect.plist"; CCParticleSystemQuad *pEmitter = CCParticleSystemQuad::particleWithFile( filename.c_str() ); pEmitter->setPosition( touchLocation ); CCPoint pos = getPosition(); addChild( pEmitter, 100 ); }
void createBarrelExplosion(CCNode *ccLayer, float x,float y) { CCParticleSystemQuad *emitter = CCParticleSystemQuad::create("ctm_BarrelExplosion.plist"); emitter->setPosition(ccp(x*ScreenHelper::getCameraZoom(),y*ScreenHelper::getCameraZoom())); emitter->setScale(ScreenHelper::getTextureScale()); ccLayer->addChild(emitter); }
void ShowLayer::useFZPower(Vec2 pt) { //点击粒子特效 CCParticleSystemQuad *mParticle = CCParticleSystemQuad::create("showClick.plist"); mParticle->setScale(0.5f); mParticle->setPosition(pt); //如果不设置,粒子播放后内存不释放 mParticle->setAutoRemoveOnFinish(true); this->addChild(mParticle); Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 pt2; pt2.x = (pt.x - visibleSize.width / 2) < 0 ? -5 : 5; pt2.y = (pt.y - visibleSize.height / 2) < 0 ? -5 : 5; auto action = MoveTo::create(0.2f, pt2); auto action2 = MoveTo::create(0.5f, Vec2(-pt2.x, -pt2.y)); auto action3 = ScaleTo::create(0.2f, 1.1f); auto action4 = ScaleTo::create(0.5f, 1.0f); //屏幕震动特效 this->m_Map->runAction(Sequence::create(Spawn::create(action, action3, NULL), Spawn::create(action2, action4, NULL), NULL)); //使用人物技能 m_PlayerManager->useFZ(pt, m_MonsterManager->getMonsterList(), m_BossManager->getboss(), m_FirePower); }
// The kaboom stuff void InGamePowers::OnFreezeBallHit(CCNode* sender) { // Do all the magic here mCurrentActiveTroll->mFreezedTime = 10;//Get from missions some param? // Remove the indicator ? if(mCurrentActiveTroll->getChildByTag(TROLL_WTF_INDICATOR)!=NULL){ mCurrentActiveTroll->removeChildByTag(TROLL_WTF_INDICATOR); } // Add for now blue troll FX mCurrentActiveTroll->_animation->setColor(ccc3(0, 164, 255)); // Remove the ball if(mGameScene->getChildByTag(FLY_BALL_MASTER_TROLL)!=NULL){ mGameScene->removeChildByTag(FLY_BALL_MASTER_TROLL); } // Create some particles and sound ??? CCParticleSystemQuad* p = CCParticleSystemQuad::create("Particles/bullet_explode.plist"); p->setPosition(mCurrentActiveTroll->getPositionX(), mCurrentActiveTroll->getPositionY()); p->setAutoRemoveOnFinish(true); mGameScene->addChild(p,5002); mGameScene->playInGameSound("dwarf_crash"); // Clear it mCurrentActiveTroll = NULL; // Reset the correct button? button_2->setEnabled(true); button_2->setOpacity(255); }
cocos2d::CCNode* GameScene::createParticle(const char *plistFile, const cocos2d::CCPoint &tagPoint) { CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create(plistFile); pParticle->setPosition(tagPoint); background->addChild(pParticle, kZOrderPartical); return pParticle; }
bool HelloWorld::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { CCPoint pos =pTouch->getLocation(); CCParticleSystemQuad* quad = (CCParticleSystemQuad*)this->getChildByTag(1); quad->setPosition(pos); return true; }
void BlackHoleEffectTest::attenuationComplete(CCObject* obj) { //这里可以将黑洞的显示效果慢慢缩小。 BlackHoleEffect* blackHole = (BlackHoleEffect*)obj; CCParticleSystemQuad* blackHoleParticle = (CCParticleSystemQuad*)blackHole->getUserObject(); CCScaleTo* st = CCScaleTo::create(2, 0); blackHoleParticle->runAction(st); }
//自定义plist粒子特效 void HelloWorld::testPlist() { CCPoint mysize = CCDirector::sharedDirector()->getVisibleSize(); CCParticleSystemQuad* quad = CCParticleSystemQuad::create("1.plist"); quad->setPosition( mysize/2 ); this->addChild(quad,1,1); }
CCParticleBatchNode* AppConfig::createParticleBatchNode(const char * plistFileName, unsigned particleNodeCount) { CCParticleSystemQuad* particle = CCParticleSystemQuad::create(plistFileName); CCParticleBatchNode* particleBatchNode = CCParticleBatchNode::createWithTexture(particle->getTexture()); for(unsigned index = 0; index < particleNodeCount; index++) createParticle(plistFileName,particleBatchNode); return particleBatchNode; }
CCParticleSystemQuad * CCParticleSystemQuad::createWithTotalParticles(unsigned int numberOfParticles) { CCParticleSystemQuad *pRet = new CCParticleSystemQuad(); if (pRet && pRet->initWithTotalParticles(numberOfParticles)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return pRet; }
CCParticleSystemQuad * CCParticleSystemQuad::create() { CCParticleSystemQuad *pParticleSystemQuad = new CCParticleSystemQuad(); if (pParticleSystemQuad && pParticleSystemQuad->init()) { pParticleSystemQuad->autorelease(); return pParticleSystemQuad; } CC_SAFE_DELETE(pParticleSystemQuad); return NULL; }
CCParticleSystemQuad * CCParticleSystemQuad::create(const char *plistFile) { CCParticleSystemQuad *pRet = new CCParticleSystemQuad(); if (pRet && pRet->initWithFile(plistFile)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return pRet; }
void HSBalloonSprite::PlayDestroyBalloonEffect() { this->setVisible(false); CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("Particle/DestroyBalloon.plist"); pParticle->setPosition(m_destroyPos); HS_GET_BattleLayer()->addChild(pParticle,1100); CCDelayTime* pDelayTime = CCDelayTime::create(1.f); CCCallFuncND* pCall_01 = CCCallFuncND::create(this,callfuncND_selector(HSBalloonSprite::Call_PlayDestroyBalloonEffect),NULL); pParticle->runAction(CCSequence::create(pDelayTime,pCall_01,NULL)); }
bool RigidBlock::tryLaunchParticle(CCPoint emitPoint) { CCParticleSystemQuad *particle = CCParticleSystemQuad::create("NewBlockParticle_1.plist"); particle->setAnchorPoint(ccp(0.5f, 0.5)); particle->setPosition(m_position); particle->setAutoRemoveOnFinish(true); this->addChild(particle); return true; }
//----------------------------------------------- // // void CPet::upMainData( ccTime dt ) { if( CPET_STATE_DISTANCE_ATTACK == m_iState ) { //int index = GetCurentIndex(); CBaseDataPet* pDataPet = g_pClientLoader->GetBaseDataPetFromId(m_PetData.petid); CBaseDataSkill* pDataSkill = g_pClientLoader->GetBaseDataSkillFromId(pDataPet->skillfield[m_PetData.skilllevel.skillsLevel[0]-1]); if( pDataSkill->attack_frame <= GetCurentIndex()) { CCMoveTo *to1 = CCMoveTo::actionWithDuration( 1.0f, m_pLockTarget->getPosition() ); SAttackType *pAttackType = new SAttackType(); pAttackType->Type = 1; CCFiniteTimeAction *pCallBack = CCCallFuncND::actionWithTarget( this, callfuncND_selector( CPet::AttackBeginCallBack ), pAttackType ); std::string effectpath = GetGameParticlePath(); std::string filename = effectpath + pDataSkill->plist.c_str(); CCParticleSystemQuad *pEmitter = CCParticleSystemQuad::particleWithFile( filename.c_str() ); //panda if( m_PetData.petid >= 41 && m_PetData.petid <= 50 ) { pEmitter->setPositionType( kCCPositionTypeGrouped ); } if( FIGHT_LEFT_PLAYER_POS == m_iSitId ) { pEmitter->setPosition( ccp( getPosition().x + 32, getPosition().y ) ); } else { pEmitter->setPosition( ccp( getPosition().x - 16, getPosition().y ) ); } if( CCUserDefault::sharedUserDefault()->getBoolForKey( "sound" ) ) { string path = "data/audio/" + pDataSkill->skill_sound; CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(path.c_str(), false); } CCPoint pos = getPosition(); g_pFightGroundLayer->addChild( pEmitter, 100, FIRE_BALL_TAG ); pEmitter->runAction( CCSequence::actions( to1, pCallBack, NULL ) ); m_iState = CPET_STATE_NONE; } } }
void MainFooterLayer::showLiziXiaoguo(CCNode* pParent, int iTag) { //极限守城20级开启,所以效果20级才显示 //竞技8级开启,所以效果8级才显示 int iMinLevel = 8; if (iTag == TAG_Jixianshoucheng_lizi_Ani) { iMinLevel = 20; } if (!pParent || MyselfManager::getManager()->getMyZhuJueData()->getCurrentProperty().level < iMinLevel) { return; } CCNode* pNode = pParent->getChildByTag(iTag); if (pNode) { return; } CCParticleSystemQuad* par = CCParticleSystemQuad::create("jingji_xiaoguo.plist"); pParent->addChild(par, 2, iTag); //par->setScale(0.5f); //par->setSpeed(10); par->setPosition(ccp(0, 0)); CCPointArray *array = CCPointArray::create(20); array->addControlPoint(ccp(0, 0)); array->addControlPoint(ccp(pParent->getContentSize().width, 0)); array->addControlPoint(ccp(pParent->getContentSize().width, pParent->getContentSize().height)); array->addControlPoint(ccp(0, pParent->getContentSize().height)); float dt = 0.5f; CCMoveTo* action1 = CCMoveTo::create(dt, array->getControlPointAtIndex(1)); CCMoveTo* action2 = CCMoveTo::create(dt, array->getControlPointAtIndex(2)); CCMoveTo* action3 = CCMoveTo::create(dt, array->getControlPointAtIndex(3)); CCMoveTo* action4 = CCMoveTo::create(dt, array->getControlPointAtIndex(0)); CCSequence* quece = CCSequence::create(action1, action2, action3, action4, NULL); par->runAction( CCRepeatForever::create( //FXCircleBy::create(1.0f, ccp(pJingjiItem->getContentSize().width/2, pJingjiItem->getContentSize().height/2 + 5), 24, 360) quece ) ); }
void BlackHoleEffectTest::overComplete(CCObject* obj) { //黑洞完全消失,可以将黑洞显示对象删除 BlackHoleEffect* blackHole = (BlackHoleEffect* )obj; CCParticleSystemQuad* blackHoleParticle = (CCParticleSystemQuad*)blackHole->getUserObject(); blackHoleParticle->removeFromParent(); int length = this->ary->count(); for (int i = length - 1; i >= 0; i--) { BlackHoleEffect* bh = (BlackHoleEffect* )this->ary->objectAtIndex(i); if (bh == blackHole) { this->ary->removeObjectAtIndex(i); break; } } }
//------------------------------------------------------------------ // // Issue870 // //------------------------------------------------------------------ void Issue870::onEnter() { ParticleDemo::onEnter(); setColor(ccBLACK); removeChild(m_background, true); m_background = NULL; CCParticleSystemQuad *system = new CCParticleSystemQuad(); system->initWithFile("Images/SpinningPeas.plist"); system->setTextureWithRect(CCTextureCache::sharedTextureCache()->addImage("Images/particles.png"), CGRectMake(0,0,32,32)); addChild(system, 10); m_emitter = system; m_nIndex = 0; schedule(schedule_selector(Issue870::updateQuads), 2.0f); }
void ccbStartGame::setAnimationManager(CCBAnimationManager *pAnimationManager, CGameControler* _pGameControler) { CC_SAFE_RELEASE_NULL(m_AnimationManager); m_AnimationManager = pAnimationManager; CC_SAFE_RETAIN(m_AnimationManager); m_pGameControler = _pGameControler; if ( m_pGameControler->m_unLevel%6 != 5 && m_pGameControler->m_unLevel < 30 && m_pGameControler->m_unLevel >= 0 ) m_bType = 0; else m_bType = 1; if ( m_bType ) { m_pNode->setVisible(false); m_pNode2->setVisible(true); //CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("tu8/wind.plist"); //pParticle->setAnchorPoint(ccp(0.5f, 0.0f)); //pParticle->setPosition(ccp(357, 172)); //m_pNode2->addChild(pParticle, -1); CCSprite* pSprite = CCSprite::create("tu8/feijiti.png"); pSprite->setAnchorPoint(ccp(0.0f,0.0f)); //pSprite->setPosition(ccp(100,-100)); m_pNode2->addChild(pSprite); CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("tu8/1.plist"); //pParticle->setAnchorPoint(ccp(0.5f, 0.0f)); pParticle->setPosition(ccp(440, 210)); m_pNode2->addChild(pParticle); } else { m_pNode2->setVisible(false); m_pNode->setVisible(true); //CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("tu8/wind.plist"); //pParticle->setAnchorPoint(ccp(0.5f, 0.0f)); //pParticle->setPosition(ccp(357, 172)); //m_pNode->addChild(pParticle, -1); CCSprite* pSprite = CCSprite::create("tu8/feijiti.png"); pSprite->setAnchorPoint(ccp(0.0f,0.0f)); //pSprite->setPosition(ccp(100,-100)); m_pNode->addChild(pSprite); CCParticleSystemQuad* pParticle = CCParticleSystemQuad::create("tu8/1.plist"); //pParticle->setAnchorPoint(ccp(0.5f, 0.0f)); pParticle->setPosition(ccp(440, 210)); m_pNode->addChild(pParticle); } }
bool BlackHoleEffectTest::ccTouchBegan(CCTouch* touch, CCEvent* event) { CCParticleSystemQuad* blackHoleParticle = CCParticleSystemQuad::create("blackHoleEffect.plist"); blackHoleParticle->setPosition(touch->getLocation()); blackHoleParticle->setAutoRemoveOnFinish(true); this->addChild(blackHoleParticle); BlackHoleEffect* bh = BlackHoleEffect::create(); bh->setInHoleSelector(this, in_hole_selector(BlackHoleEffectTest::inHoleComplete)); bh->setAttenuationSelector(this, attenuation_selector(BlackHoleEffectTest::attenuationComplete)); bh->setOverSelector(this, over_selector(BlackHoleEffectTest::overComplete)); bh->setUserObject(blackHoleParticle); bh->addSubstanceList(this->objList); bh->addHole(touch->getLocation().x, touch->getLocation().y); this->ary->addObject(bh); return true; }
void Box::playBurst(CCNode* sender, void* data) { Tile2 *tile = static_cast<Tile2 *>(data); CCLOG("Scaling tile %d,%d with delay %f", tile->x, tile->y); CCFiniteTimeAction *action = CCSequence::create( CCScaleTo::create(0.3f, 0.0f), CCCallFuncN::create(this, callfuncN_selector(Box::removeSprite)), NULL ); tile->sprite->runAction(action); // Add the balloon burst effect CCParticleSystemQuad *burst = CCParticleSystemQuad::create(burst_effect_filename.c_str()); burst->setPosition(tile->pixPosition()); burst->setAutoRemoveOnFinish(true); layer->addChild(burst); }
CCParticleSystemQuad* ParticleManagerX::getParticle(const char *name) { CCAssert(name && strlen(name) > 0, "!!! ParticleManager::getParticle(name) name is invalid"); if (!name || strlen(name) <= 0) { return NULL; } CCParticleSystemQuad *particle = NULL; for(ParticleEmittersMap::iterator it = this->m_ParticleEmittersMap.begin(); it != this->m_ParticleEmittersMap.end(); it++) { ParticleEmitters *emitters = (ParticleEmitters*)(it->second); if (emitters && name) { particle = emitters->getParticle(name); } if (particle) { particle->setAutoRemoveOnFinish(true); break; } } return particle; }
//implement touch bool GameScene::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event){ if (bird->getFalling() == false){ this->unschedule(schedule_selector(GameScene::StopFlying)); bird->Fly(); this->scheduleOnce(schedule_selector(GameScene::StopFlying), BIRD_FLY_DURATION); CCParticleSystemQuad* p = CCParticleSystemQuad::create("jetPack.plist"); p->setPosition(bird->getPosX(), bird->getPosY()); this->addChild(p); return true; } bird->Fly(); this->scheduleOnce(schedule_selector(GameScene::StopFlying), BIRD_FLY_DURATION); CCParticleSystemQuad* p = CCParticleSystemQuad::create("jetPack.plist"); p->setPosition(bird->getPosX(), bird->getPosY()); this->addChild(p); return true; }
void Player::Die() { // first reduce lives lives_ = (--lives_ < 0) ? 0 : lives_; // respawn only if there are lives remaining is_respawning_ = (lives_ > 0); // animate the death :( CCActionInterval* death = CCSpawn::createWithTwoActions(CCFadeOut::create(0.5f), CCScaleTo::create(0.5f, 1.5f)); // call the appropriate callback based on lives remaining CCActionInstant* after_death = (lives_ <= 0) ? (CCCallFunc::create(this, callfunc_selector(Player::OnAllLivesFinished))) : (CCCallFunc::create(this, callfunc_selector(Player::Respawn))); runAction(CCSequence::createWithTwoActions(death, after_death)); // play a particle...a sad one :( CCParticleSystemQuad* explosion = CCParticleSystemQuad::create("explosion.plist"); explosion->setAutoRemoveOnFinish(true); explosion->setPosition(m_obPosition); game_world_->addChild(explosion); SOUND_ENGINE->playEffect("blast_player.wav"); }
void MagicWitch::RunParticle() { CCParticleSystemQuad *particle = CCParticleSystemQuad::create( "witch0.plist"); particle->setDuration(2.0f); particle->setPosition(ccp( particle->getPositionX() * SCALE_X, particle->getPositionY() * SCALE_Y)); particle->setScale(BUTTON_SCALE); particle->setAutoRemoveOnFinish(true); my_layer_->getParent()->addChild(particle, gameconfig::WITCH_ANIM_NODE_ZORDER); }
void GameScene::updateProjectiles(float dt) { if (m_bullets->count() > 0) { CCObject* ob = NULL; CCARRAY_FOREACH(m_bullets, ob) { Projectile* proj = dynamic_cast<Projectile*>(ob); proj->update(dt); if (proj->getPositionX() < 0.f - proj->getContentSize().width || proj->getPositionX() > m_visibleSize.width + proj->getContentSize().width) m_removableBullets->addObject(proj); else if (checkCollisions(m_hero, proj) && proj->getType() == Projectile::Bullet) { m_removableBullets->addObject(proj); updateHealth(10); // dmg value here } else { for (uint i = 0; i < m_enemies->count(); ++i) { Enemy* en = dynamic_cast<Enemy*>(m_enemies->objectAtIndex(i)); if (checkCollisions(en, proj) && proj->getType() == Projectile::Rocket) { m_removableBullets->addObject(proj); m_removables->addObject(m_enemies->objectAtIndex(i)); CCParticleSystemQuad * smokeParticle = CCParticleSystemQuad::create("textures/smoke.plist"); smokeParticle->setPosition(en->getPosition()); this->addChild(smokeParticle); smokeParticle->setAutoRemoveOnFinish(true); CCParticleSystemQuad * dustParticle = CCParticleSystemQuad::create("textures/dusts.plist"); dustParticle->setPosition(en->getPosition()); this->addChild(dustParticle); dustParticle->setAutoRemoveOnFinish(true); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/rocketExplode.wav", false); CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/enemyKill.wav", false); updateScore(); //score value here } } } }
void CSignLayer::initHeroData() { int iSize = m_signData.signList.size(); for(unsigned int i=0; i<iSize; i++) { CSign &sign = m_signData.signList.at(i); if(sign.prize.type==2) { const HeroInfoData *data = DataCenter::sharedData()->getHeroInfo()->getCfg(sign.prize.thumb); //详细信息 if(data) { m_pInfo1->setString(CCString::createWithFormat("%s(%s)", data->heroName.c_str(), GETLANGSTR(data->iType1+1189))->getCString()); if(data->iType1==1) m_pInfo1->setColor(ccc3(220, 82, 31)); if(data->iType1==2) m_pInfo1->setColor(ccc3(91, 162, 247)); if(data->iType1==3) m_pInfo1->setColor(ccc3(255, 234, 19)); std::string sInfo = data->heroStory; for(unsigned int i=0; i<sInfo.size(); i++) { if(sInfo[i] == '|') { sInfo[i] = '\n'; } } m_pInfo2->setString(sInfo.c_str()); updateShowInfoScroll(); } //动画 //参考zorder CCNode* pNode = (CCNode*)m_ui->findWidgetById("board_sign"); //增加人物贴图 CCString* pStr = CCString::createWithFormat("sign/%d.png", sign.prize.thumb); CCSprite* pHero = CCSprite::create(pStr->getCString()); if(!pHero) { CCLOG("ERROR-Missing picture %s", pStr->getCString()); pHero = CCSprite::create("sign/arrival_ch_01.png"); } pHero->setPosition(CCPointZero); pHero->setAnchorPoint(CCPointZero); m_pClip->addChild(pHero); //添加粒子 CCString* pStrLz = CCString::createWithFormat("lz/sign_lz_%d.plist", data->iType1); std::string fullPathLz = CCFileUtils::sharedFileUtils()->fullPathForFilename(pStrLz->getCString()); if(!CCFileUtils::sharedFileUtils()->isFileExist(fullPathLz)) { //创建过程不会返回null,直接报错,所以在前面判断文件存在 CCLOG("ERROR-missing plist file%s", pStrLz->getCString()); pStrLz = CCString::create("lz/sign_lz_3.plist"); } CCParticleSystemQuad* pLz = CCParticleSystemQuad::create(pStrLz->getCString()); pLz->setPosition(ccp(pHero->getPositionX()+pHero->getContentSize().width/2-30, pHero->getPositionY()-20)); m_pClip->addChild(pLz, 2); pHero->setPositionX(pHero->getPositionX()-600); pHero->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.3f), CCMoveBy::create(0.2f, ccp(600, 0)))); //const CWholeBodyShowInfo& pInfo = CWholeBodyShowData::getInstance()->getDataById(sign.prize.thumb); //CCSprite* pNodePos = (CCSprite*)m_ui->findWidgetById("monster_pos"); //pNodePos->setVisible(true); //pNodePos->setOpacity(0); //CCPoint pPos = pNodePos->getPosition(); //char c_json[60] = {0}; //char c_altlas[60] = {0}; //sprintf(c_json,"storyImage/Spine/888%d.json",sign.prize.thumb); //sprintf(c_altlas,"storyImage/Spine/888%d.atlas",sign.prize.thumb); //std::string sFullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(c_json); //if(!CCFileUtils::sharedFileUtils()->isFileExist(sFullPath)) //{ // CCLOG("ERROR -CSignLayer::initHeroData-file not foud-%s", c_json); // sprintf(c_json,"storyImage/Spine/888756.json"); // sprintf(c_altlas,"storyImage/Spine/888756.atlas"); //} //SkeletonAnimation* Animation = SkeletonAnimation::createWithFile(c_json,c_altlas,1); //Animation->setAnimation(0,"stand",true); //pNodePos->addChild(Animation); //Animation->setScale(pInfo.fScale*0.65f); break; } } }
void BlockManager::Particle(CGPoint _pos) { CCParticleSystemQuad* particle; particle = new CCParticleSystemQuad; particle->initWithTotalParticles(600); particle->autorelease(); CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("Tile/Tile_Ground_2.png"); particle->setTexture(texture); particle->setEmissionRate(296.43); particle->setAngle(90.0); particle->setAngleVar(36.2); ccBlendFunc blendFunc= {GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA}; particle->setBlendFunc(blendFunc); particle->setDuration(0.10); particle->setEmitterMode(kCCParticleModeGravity); ccColor4F startColor= {1.00,1.00,1.00,1.00}; particle->setStartColor(startColor); ccColor4F startColorVar= {0.00,0.00,0.00,0.00}; particle->setStartColorVar(startColorVar); ccColor4F endColor= {1.00,1.00,1.00,0.55}; particle->setEndColor(endColor); ccColor4F endColorVar= {0.00,0.00,0.00,0.00}; particle->setEndColorVar(endColorVar); particle->setStartSize(6.03); particle->setStartSizeVar(0.00); particle->setEndSize(-1.00); particle->setEndSizeVar(0.00); particle->setGravity(ccp(0.00, -1837.19)); particle->setRadialAccel(0.00); particle->setRadialAccelVar(0.00); particle->setSpeed(234); particle->setSpeedVar(300); particle->setTangentialAccel(0); particle->setTangentialAccelVar(0); particle->setTotalParticles(501); particle->setLife(1.69); particle->setLifeVar(0.10); particle->setStartSpin(0.00); particle->setEndSpin(0.00); particle->setEndSpinVar(0.00); particle->setPosition(_pos); particle->setPosVar(ccp(10.00,0.00)); m_pGround->addChild(particle); }