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-我想改變火焰的顏色。
如果你能幫幫.....
@deanWombourne .. Thax –