使用cocos2d,我正在尝试用粒子系统替换sprite(我的代码中的项)。这段代码放在我的董事会课堂上。这个有效:
// 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吗?
答案 0 :(得分:0)
当你销毁一个节点时,你也会销毁它所有的子节点,你说你将粒子添加到'项目'然后你破坏那个' item',这意味着你不再有粒子了。