2015-09-07 69 views
0

我有一个粒子系统,我在下面的方式使用粒子效果[不CCParticleSystemQuad改变其父的位置WRT]

DustParticle = CCParticleSystemQuad::create("dust_texture.plist"); 
    Vec2 pos = Vec2(
         BadSprite->getPositionX() 
         BadSprite->getPositionY() 
        ); 
    Vec2 World = BadSprite->getParent()->convertToWorldSpace(pos); 
    Vec2 Node = BadSprite->convertToNodeSpace(World); 
    DustParticle->setPosition(Node); 

    BadSprite->addChild(DustParticle); 

现在,这里是发生了什么BadSprites朝但是左边的粒子效果动人似乎被卡住在它不是推出的位置,它也假设在其父母向左移动时向左移动?关于可能发生什么的任何建议?附加为小孩时,粒子效果会有不同的表现。我知道如果我附加了一个精灵,它会跟随父母。

回答

0

不,粒子效应应该跟随精灵。我把它们连接连到节点(由年轻的彼得,http://weibo.com/young40创建SpriterNode),这样,一切都工作得很好:

_characterNode = SpriterNode::create(nameScml,namePng); 
_characterNode->setContentSize(sprObject->getContentSize()); 
this->addChild(_characterNode); 

power[0] = ParticleSystemQuad::create("particle_light.plist"); // it was an array of effects on the one object 
power[0]->setPosition(0, 0.5 * _characterNode->getContentSize().height); 
_characterNode->addChild(power[0]); 

我看你使用CCParticleSystemQuad,因此它的的Cocos2D-X的一些较老的版本。也许只是这个?我的例子是用3.6版写的。试试这个版本。