我有一个节点(名为'terrain'),我偏移,以便我的主要游戏对象(我的角色)保持在屏幕的中心。我是这样做的:
[_terrain setOffsetX:offsetX andOffsetY:offsetY*4/3];
事实上,在我的地形上,我有一个粒子系统。当移动我的角色(并因此抵消地形)时,发出的粒子不会指向它们的向上字轨迹。看起来发射的粒子是去相关的。这是我在我的地形类中包含的粒子系统代码(即自我指的是地形本身):
emitterSnow = [CCParticleSnow node];
emitterSnow.position = startPoint;
[emitterSnow setAnchorPoint:CGPointZero];
[self addChild:emitterSnow z:0 tag:windIndicatorTag];
CGPoint p = emitterSnow.position;
emitterSnow.position = ccp( p.x + width/2 , p.y);
emitterSnow.life = 1;
emitterSnow.lifeVar = .3f;
[emitterSnow setIsRelativeAnchorPoint:YES];
emitterSnow.posVar = CGPointMake(width/2,0);
// gravity
emitterSnow.gravity = ccp(0,1000);
// speed of particles
emitterSnow.speed = 140;
emitterSnow.speedVar = 20;
ccColor4F startColor = emitterSnow.startColor;
startColor.r = 0.9f;
startColor.g = 0.9f;
startColor.b = 0.9f;
emitterSnow.startColor = startColor;
ccColor4F startColorVar = emitterSnow.startColorVar;
startColorVar.b = 0.1f;
emitterSnow.startColorVar = startColorVar;
emitterSnow.emissionRate = 30;
emitterSnow.texture = [[CCTextureCache sharedTextureCache] addImage: @"bubble2.png"];
如何让我的粒子从我的粒子系统源向上移动?
答案 0 :(得分:1)
尝试设置positionType
(a tCCPositionType
)。使用kCCPositionTypeFree
(默认值)自由移动粒子。或者使用kCCPositionTypeGrouped
将它们移到一个组中。