-(id) init {
if( (self=[super init] )) {
emitter = [CCParticleFire node];
emitter.position = ccp(160,240);
emitter.positionType = kPositionTypeFree;
[self addChild: emitter];
[self schedule:@selector(UpdatePosition) interval:1.0/60];
}
return self;
}
- (void) UpdatePosition {
static float sx = 3,sy = 3;
if (emitter.position.x < 0 || emitter.position.x > 320) sx = -sx;
if (emitter.position.y < 0 || emitter.position.y > 480) sy = -sy;
emitter.position = ccp(emitter.position.x + sx, emitter.position.y + sy);
}
The code like that, update a CCParticleSystem's position every frame. When the particle emitter hits the boundary, it bounces back. But when it hit, all visible particles shaked. Just the time the "sx" or "sy" changed. I don't know where is the problem.
Set "emitter.positionType = kPositionTypeGrouped;" it's ok.
Set "emitter.positionType = kPositionTypeFree;" it has the shake problem.