0

我有一个节点(名为“地形”),我偏移了这个节点,以便我的主要游戏对象(我的角色)保持在屏幕的中心。我这样做:

 [_terrain setOffsetX:offsetX andOffsetY:offsetY*4/3];

问题是在我的地形上,我有一个粒子系统。当移动我的角色(从而抵消地形)时,发射的粒子不会保持它们的上行轨迹。看起来发射的粒子是相移的。这是我包含在地形类中的粒子系统代码(即 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"];

如何让我的粒子从我的粒子系统源向上移动?

4

1 回答 1

1

尝试设置positionType(a tCCPositionType)。使用kCCPositionTypeFree(默认之一)自由移动粒子。或用于kCCPositionTypeGrouped在一组中移动它们。

于 2012-07-10T07:58:25.117 回答