我有一个节点(名为'terrain'),我对它进行了偏移,这样我的主要游戏对象(我的角色)就会停留在屏幕的中心。我是这样做的:
[_terrain setOffsetX:offsetX andOffsetY:offsetY*4/3];问题是在我的地形上,我有一个粒子系统。当移动我的角色(从而抵消地形)时,发射的粒子不会引导它们的向上单词轨迹。它看起来像是发射的粒子是反相位的。下面是我在terrain类中包含的粒子系统代码(即self指的是地形本身):
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"];如何让粒子从粒子系统源向上移动?
发布于 2012-07-10 15:58:25
尝试设置positionType ( tCCPositionType)。使用kCCPositionTypeFree (默认设置)可自由移动粒子。或者使用kCCPositionTypeGrouped将它们移动到一个组中。
https://stackoverflow.com/questions/11408880
复制相似问题