本文整理汇总了C++中ParticleSystemQuad类的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystemQuad类的具体用法?C++ ParticleSystemQuad怎么用?C++ ParticleSystemQuad使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParticleSystemQuad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showStarAni
void PBase::showStarAni(WJSprite *starSprite)
{
if (WJUtils::equals(starSprite->getUserString(), "get"))
{
starSprite->setVisible(true);
}
else
{
Common::sound.play("Common:star");
// 添加星星出现的粒子效果
ParticleSystemQuad *starParticle = ParticleSystemQuad::create("particles/star.plist");
starParticle->setPosition(Vec2(starSprite->getContentSize().width / 2, starSprite->getContentSize().height / 2));
starSprite->addChild(starParticle);
starParticle->setAutoRemoveOnFinish(true);
starSprite->setUserString("get");
starSprite->runAction(
Sequence::create(
ScaleTo::create(0.0f, 0.0f, 0.0f),
Show::create(),
Spawn::create(
ScaleTo::create(0.3f, 1.0f, 1.0f),
RotateBy::create(0.3f, 360.0f, 360.0f),
NULL),
NULL));
}
}
示例2: isCollisionWithCoin
bool GameScene::isCollisionWithCoin() //和金币的碰撞检测
{
bool aFlag = false;
for (int i=0; i<coinArray.size(); i++) {
Rect box = coinArray.at(i)->boundingBox();
if (player->boundingBox().intersectsRect(box))
{
//当金币可见的时候才放粒子效果和音效
if ( coinArray.at(i)->isVisible() == true) {
coinArray.at(i)->setVisible(false);
//粒子效果
ParticleSystemQuad *paritcle = ParticleSystemQuad::create("physic-con.plist");
paritcle->setPosition(coinArray.at(i)->getPosition());
paritcle->setAutoRemoveOnFinish(true);
this->addChild(paritcle,8);
this->progressUpdate();//调用进度条事件
player->addScore(1);//加分
if (isPlaySound) {
SimpleAudioEngine::getInstance()->playEffect("eatcoin.caf");
}
}
}
}
return aFlag;
}
示例3: ShipAccelerate
//飞船加速效果
void SceneGame::ShipAccelerate(const Point& point)
{
ParticleSystemQuad *emitter = ParticleSystemQuad::create("Image/Comet.plist");
emitter->setPosition(point);
emitter->setRotation(-45.0);
this->addChild(emitter, 10);
}
示例4: UI_addParticle
void StarNode::UI_addParticle(){
Point delta = _starRef->getStartPoint() - _starRef->getEndPoint();
//出一个星星试试
ParticleSystemQuad *particle = CCParticleSystemQuad::create("Shoot.plist");
this->addChild( particle );
particle->setDuration( _starRef->getDuration() ); //持续时间
particle->setPosition( Point() );
//上270下90左0右180
float x = delta.x;
float y = delta.y;
float angle ;
if ( ( delta.x > -0.01 || delta.x < 0.01 ) ) {
angle = 270;
}else{
angle = fabs( atanf( delta.y/delta.x ) *180/3.1415 );
}
if ( x >= 0 && y > 0) {
}else if ( x < 0 && y >= 0 ){
angle += 90;
}else if ( x < 0 && y <= 0 ){
angle += 180;
}else if ( x >= 0 && y < 0 ){
angle += 270;
}
particle->setAngle( angle );
particle->setAngleVar( 0 );
}
示例5: emittParticles
void Blocks::emittParticles(cocos2d::Layer *layer, cocos2d::Point point)
{
ParticleSystemQuad *emitter = ParticleSystemQuad::create("Json/XXX.plist");
emitter->retain();
emitter->setPosition(point);
layer->addChild(emitter, PARTICLE_ZORDER);
}
示例6: init
bool GameScene::init(){
Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin();
auto sprite = Sprite::create("bj2.jpg");
sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
this->addChild(sprite, -4);
auto bg1 = Sprite::create("b2.png");
bg1->setAnchorPoint(Point(0, 0));
bg1->setPosition(Point(0, 10));
this->addChild(bg1, -3);
auto bg2 = Sprite::create("b2.png");
bg2->setAnchorPoint(Point(0, 0));
bg2->setPosition(Point(bg1->getContentSize().width, 10));
this->addChild(bg2, -3);
distanceBg.pushBack(bg1);
distanceBg.pushBack(bg2);
auto bg3 = Sprite::create("b1.png");
bg3->setAnchorPoint(Point(0, 0));
bg3->setPosition(Point(0, 0));
this->addChild(bg3, -2);
auto bg4 = Sprite::create("b1.png");
bg4->setAnchorPoint(Point(0, 0));
bg4->setPosition(bg3->getContentSize().width, 0);
this->addChild(bg4, -2);
nearbyBg.pushBack(bg3);
nearbyBg.pushBack(bg4);
ParticleSystemQuad *emiter = ParticleSystemQuad::create("dirt.plist");
emiter->setPosition(visibleSize.width/2, visibleSize.height/2);
this->addChild(emiter, -3);
map = TMXTiledMap::create("map.tmx");
map->setAnchorPoint(Point(0, 0));
map->setPosition(Point(0, 0));
this->addChild(map, -1);
addPlayer(map);
addHeart(map);
playFlyToScene();
Node *ground = Node::create();
float width = map->getContentSize().width;
float height = map->getContentSize().height * 3 / 16;
auto bottomBody = PhysicsBody::createEdgeSegment(Point(0, height), Point(width, height));
ground->setPhysicsBody(bottomBody);
this->addChild(ground);
return true;
}
示例7: onDialogShown
void ShowStar::onDialogShown(LBModalDialog *dialog)
{
const Size &size = Director::getInstance()->getWinSize();
ParticleSystemQuad *particle = ParticleSystemQuad::create("particles/opennning.plist");
particle->setPosition(dialog->convertToNodeSpace(Vec2(size.width / 2, size.height / 2)));
particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
dialog->addChild(particle, 50);
}
示例8: playParticle
void Star::playParticle()
{
const Size &size = this->getContentSize();
ParticleSystemQuad *particle = ParticleSystemQuad::create("particles/heartui.plist");
particle->setPosition(Vec2(size.width / 2, size.height / 2)+ Vec2(0, 0));
particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
this->addChild(particle, 1000);
}
示例9: playStarParticle
void ShowStar::playStarParticle(WJSprite *sprite, const char * file)
{
// 播放粒子效果
ParticleSystemQuad *particle = ParticleSystemQuad::create(file);
particle->setPosition(sprite->getPosition());
particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
sprite->getParent()->addChild(particle, sprite->getLocalZOrder() + 10);
}
示例10: if
bool Breakout::onConcactBegan(PhysicsContact& contact) {
auto nodeA = contact.getShapeA()->getBody()->getNode();
auto nodeB = contact.getShapeB()->getBody()->getNode();
if (nodeA->getTag() == 1 || nodeB->getTag() == 1) {
if(time > 0) dead();
}
else {
//播放碰撞音效
SimpleAudioEngine::getInstance()->playEffect("music/meet_stone.wav");
//陨石爆炸并消失
ParticleSystemQuad* fireWorks;
if (nodeA->getTag() != 100) {
nodeA->getPhysicsBody()->setName("isContact");
if (nodeA->getTag() == 10) {
blood -= 10;
fireWorks = ParticleSystemQuad::create("fire1.plist");
}
else if (nodeA->getTag() / 10000 == 20) {
blood -= 15;
fireWorks = ParticleSystemQuad::create("fire2.plist");
}
else {
blood -= 20;
fireWorks = ParticleSystemQuad::create("fire3.plist");
}
fireWorks->setPosition(nodeA->getPosition());
this->removeChild(nodeA);
}
else {
nodeB->getPhysicsBody()->setName("isContact");
if (nodeB->getTag() == 10) {
blood -= 10;
fireWorks = ParticleSystemQuad::create("fire1.plist");
}
else if (nodeB->getTag() == 20) {
blood -= 15;
fireWorks = ParticleSystemQuad::create("fire2.plist");
}
else {
blood -= 20;
fireWorks = ParticleSystemQuad::create("fire3.plist");
}
fireWorks->setPosition(nodeB->getPosition());
this->removeChild(nodeB);
}
this->addChild(fireWorks, 1);
for (int i = 0; i < enemys.size(); i++) {
if (enemys.at(i)->getName() == "isContact") {
enemys.erase(enemys.begin() + i);
}
}
pT->setPercentage(blood);
if (blood <= 0) dead();
}
return true;
}
示例11: addExplosion
void World::addExplosion(const Vec2 &position)
{
std::string filename = "particle/explosion.plist";
ParticleSystemQuad *emitter = ParticleSystemQuad::create(filename);
emitter->setPosition(position);
emitter->setScale(0.4);
addChild(emitter);
}
示例12: ParticleSystemQuad
ParticleSystemQuad * ParticleSystemQuad::create() {
ParticleSystemQuad *pParticleSystemQuad = new ParticleSystemQuad();
if (pParticleSystemQuad && pParticleSystemQuad->init())
{
pParticleSystemQuad->autorelease();
return pParticleSystemQuad;
}
CC_SAFE_DELETE(pParticleSystemQuad);
return NULL;
}
示例13: new
ParticleSystemQuad * ParticleSystemQuad::create() {
ParticleSystemQuad *particleSystemQuad = new (std::nothrow) ParticleSystemQuad();
if (particleSystemQuad && particleSystemQuad->init())
{
particleSystemQuad->autorelease();
return particleSystemQuad;
}
CC_SAFE_DELETE(particleSystemQuad);
return nullptr;
}
示例14: run
void CreateRainEvent::run()
{
this->setDone();
Size size = Director::getInstance()->getVisibleSize();
ParticleSystemQuad* rain = ParticleSystemQuad::create("img/rain.plist");
rain->setPosition(Vec2(size.width/2,size.height));
DungeonSceneManager::getInstance()->getScene()->addChild(rain);
}
示例15: addExplosionEffect
void BattleScene::addExplosionEffect(Vec2 point)
{
std::string fileName="boxBreak.plist";
ParticleSystemQuad *effect = ParticleSystemQuad::create(fileName);
auto scene =Director::getInstance()->getRunningScene();
if (scene) {
scene->addChild(effect,1000);
}
effect->setAutoRemoveOnFinish(true);
effect->setPosition(point);
}