0

我有一个粒子系统,我以下列方式使用它

  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 向左移动会发生什么,但是粒子效果似乎停留在它启动的位置,它是否也假设在其父级向左移动时向左移动?关于可能发生的事情有什么建议吗?当作为子项附加时,粒子效果的行为是否有所不同。我知道如果我附加了一个精灵,它将跟随父母。

4

1 回答 1

0

不,粒子效果应该跟随精灵。我什至将它们连接到节点(由 Young Peter 创建的 SpriterNode,http ://weibo.com/young40 ),就像这样,一切正常:

_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 版编写的。试试这个版本。

于 2015-10-09T13:08:25.857 回答