使用cocos2d,我试图用粒子系统替换雪碧(代码中的项目)。这段代码放在我的板类中。这个方法很有效:
// Draw the particles
CCParticleSystem *particles = [[CCParticleSystem alloc] initWithDictionary:_popParticles];
particles.position = ccpSub(item.position,ccp(160,160));
particles.autoRemoveOnFinish = TRUE;
[self addChild:particles];这张没有:
// Draw the particles
CCParticleSystem *particles = [[CCParticleSystem alloc] initWithDictionary:_popParticles];
particles.position = item.position;
particles.autoRemoveOnFinish = TRUE;
[self addChild:particles];我试过这样做,但没有成功:
particles.positionType = CCPositionTypeMake(CCPositionUnitUIPoints, CCPositionUnitUIPoints, CCPositionReferenceCornerBottomLeft);我的主板是320x320点CCSprite,锚点设置在0.5,0.5。
当我记录我的item.position值时,我得到相对于我的板左下角的东西(从30,30到290,290)。
使用ccpSub是正确的方式吗?

发布于 2015-07-27 21:44:17
当你摧毁一个节点的时候,你也摧毁了所有的子节点,你说你把你的粒子添加到'item‘然后销毁那个'item',这意味着你不再有粒子了。
https://stackoverflow.com/questions/28857186
复制相似问题