【发布时间】:2011-04-06 04:40:08
【问题描述】:
这是我在 CCTouchesMoved 中使用的代码,用于在触摸位置产生粒子效果。但是,在使用此 FPS 时,当触摸移动时,FPS 会下降到 20!我试过降低粒子的寿命和持续时间(你可以在代码中看到).....
如何解决在使用粒子效果时移动触摸时 FPS 降低的问题???
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
swipeEffect = [CCParticleSystemQuad particleWithFile:@"comet.plist"];
//Setting some parameters for the effect
swipeEffect.position = ccp(location.x, location.y);
//For fixing the FPS issue I deliberately lowered the life & duration
swipeEffect.life =0.0000000001;
swipeEffect.duration = 0.0000000001;
//Adding and removing after effects
[self addChild:swipeEffect];
swipeEffect.autoRemoveOnFinish=YES;
}
请帮帮我...我尝试使用不同的粒子并最小化生命和持续时间,但没有奏效! 有什么新想法吗?或修复我所做的事情?
【问题讨论】:
-
你在用模拟器吗?
-
@xuanweng-> 我尝试了模拟器和设备。工作相同。触摸移动时 FPS 显示大约 20。应用程序没有崩溃,但 FPS 降低了。
标签: iphone objective-c cocos2d-iphone particle-system