粒子效果[CCParticleSystemQuad是否将其位置更改为其父节点]
Particle Effect [Does CCParticleSystemQuad change its position wrt to its parent]
我有一个粒子系统,我以以下方式使用
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向左边移动,但是Particle效果似乎停留在它发射时的位置,它不也应该像它的父元素向左移动一样向左移动吗?有什么建议吗?当粒子效应被附加为儿童时,它们的行为会有所不同吗?我知道如果我附加了一个精灵,它会跟随父元素
不,粒子效果应该跟随精灵。我甚至将它们连接到节点(SpriterNode由Young Peter创建,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版本中编写的。
相关文章:
- 父节点中的垃圾值
- 包含具有无效位置的节点引用的方式
- 在链表中的第 n 个位置插入节点
- 查找二叉树的父节点函数
- 使用 C++ 在单向链表的指定位置插入节点时出现分段错误
- 从父节点中删除子节点 - PugiXML
- 在ITH位置添加节点
- 在链接列表C 中的某个位置插入节点
- 将子节点分配给父节点
- 删除链表中任意位置的节点
- 简单C++指针:如何将子节点链接到父节点
- 如何在c++中遍历treeview控件的所有父节点
- 如何在左子右兄弟树中找到节点的父节点
- 如何创建一个带有指向父节点的指针的节点类,该父节点可以设置为空
- 在c++中,子节点适合父节点的位置
- 试图创建一个指向父节点的指针,同时构建二叉树
- 从指针到成员恢复父节点
- 获取父节点的类型
- 获取二叉搜索树的父节点
- vs2015 上的 stl 列表性能不佳,同时删除包含迭代器到自身在列表中的位置的节点