我有一个带有以下代码的 xcode 项目:
在fflayer.h
诠释*芬贾尔;
在fflayer.m
-(void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
CGSize winSize = [[CCDirector sharedDirector] winSize];
CGPoint touchLocation = [self convertTouchtoNodeSpace:touch];
CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
oldTouchLocation = [CCDirector sharedDirector] convertToGL:oldLocation];
oldTouchLocation = [self convertoToNodeSpace:oldTouchLocation];
CGPoint translation = ccpSub(touchLocation, oldTouchLocation);
[self panForTranslation:translation];
if (CGRectIntersectsRect(selSprite.boundingBox, eJar.boundingBox)) {
selSprite.userData = FALSE;
selSprite.visible = FALSE;
selSprite.position = ccp(winSize.width +40, winSize.height + 40);
_currentFlies--;
ffinjar++;
}
出于某种原因,这导致 ffinjar 添加 4 而不是 1。但 _currentFlies 只是减去 1。我不知道。谁能看到我可能做错了什么?