1

私はパーティクルエンジンを実装しています。これが私のコードです:

-(id) init
{
    // always call "super" init
    // Apple recommends to re-assign "self" with the "super" return value
    if( (self=[super init] )) 
    {
        self.isTouchEnabled = YES;
        emitter = [[CCParticleMeteor alloc] init];
        emitter.texture     =   [[CCTextureCache sharedTextureCache] addImage:@"stars.png"];
        emitter.position    =   ccp( 240, 160 );
        [self addChild:emitter];

    }
    return self;
}
-(BOOL) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self ccTouchesMoved:touches withEvent:event];
    return YES;
}
-(BOOL) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *myTouch    =   [touches anyObject];
    CGPoint location    =   [myTouch locationInView:[myTouch view]];
    CGPoint point       =   [[CCDirector sharedDirector] convertToGL:location];
    emitter.position    =   ccp(point.x , point.y);
    return YES;
}

そして、ここにスクリーンショットがあります: ここに画像の説明を入力

これが必要です:

1-効果の方向を変更したい(炎が上に移動することを意味しますが、下に移動したい)。

2-炎の色を変えたい。

できれば助けてください.....

4

1 に答える 1

1

1)パーティクル システムのドキュメントをざっと見てみると、角度または重力のいずれかを操作できます。これらを異なる値に設定してみてください。

emitter.angle = <the angle you want>

2) stars.png を編集して、希望の色にしますか?

于 2011-07-06T10:23:07.800 に答える