本文整理汇总了C++中CCParticleSystemQuad类的典型用法代码示例。如果您正苦于以下问题:C++ CCParticleSystemQuad类的具体用法?C++ CCParticleSystemQuad怎么用?C++ CCParticleSystemQuad使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCParticleSystemQuad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// 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;
}
示例2: CGRectMake
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);
}
示例3: if
//-------------------------------------------------------------------------------
//
//
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 );
}
示例4: createBarrelExplosion
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);
}
示例5: useFZPower
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);
}
示例6: createParticle
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;
}
示例7: ccTouchBegan
bool HelloWorld::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
CCPoint pos =pTouch->getLocation();
CCParticleSystemQuad* quad = (CCParticleSystemQuad*)this->getChildByTag(1);
quad->setPosition(pos);
return true;
}
示例8: attenuationComplete
void BlackHoleEffectTest::attenuationComplete(CCObject* obj)
{
//这里可以将黑洞的显示效果慢慢缩小。
BlackHoleEffect* blackHole = (BlackHoleEffect*)obj;
CCParticleSystemQuad* blackHoleParticle = (CCParticleSystemQuad*)blackHole->getUserObject();
CCScaleTo* st = CCScaleTo::create(2, 0);
blackHoleParticle->runAction(st);
}
示例9: testPlist
//自定义plist粒子特效
void HelloWorld::testPlist()
{
CCPoint mysize = CCDirector::sharedDirector()->getVisibleSize();
CCParticleSystemQuad* quad = CCParticleSystemQuad::create("1.plist");
quad->setPosition( mysize/2 );
this->addChild(quad,1,1);
}
示例10: createParticleBatchNode
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;
}
示例11: CCParticleSystemQuad
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;
}
示例12: PlayDestroyBalloonEffect
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));
}
示例13: tryLaunchParticle
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;
}
示例14: SAttackType
//-----------------------------------------------
//
//
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;
}
}
}
示例15: showLiziXiaoguo
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
)
);
}