Cocos2d iphone UITapGestureRecognitor不';当很多精灵够快的时候,它就不工作了
我已将UITAPPORATE初始化如下:Cocos2d iphone UITapGestureRecognitor不';当很多精灵够快的时候,它就不工作了,cocos2d-iphone,uitapgesturerecognizer,Cocos2d Iphone,Uitapgesturerecognizer,我已将UITAPPORATE初始化如下: tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; tapGestureRecognizer.numberOfTapsRequired = 1; tapGestureRecognizer.cancelsTouchesInView = YES; [[[CCDirector sharedD
tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
tapGestureRecognizer.numberOfTapsRequired = 1;
tapGestureRecognizer.cancelsTouchesInView = YES;
[[[CCDirector sharedDirector] view] addGestureRecognizer:tapGestureRecognizer];
根据代码,如果您点击精灵,它将使用CCMoveTo动作移动到新位置,持续时间=0.3。
当一个精灵被轻触,你等待它到达新的目的地时,这个方法很好用。
到目前为止还不错
但是,如果你点击精灵的速度足够快,以获得多个精灵移动到新目的地的效果,我注意到一些精灵留在中间,并停止一些随机位置
为什么会发生这种情况?有什么想法吗?很可能在运行新的移动操作之前没有停止移动操作,导致两个移动操作在同一个精灵上同时运行。这不是同一个精灵,即使在CCMoveTo操作之前在精灵上停止所有操作,我也会遇到同样的问题。