【发布时间】:2012-07-04 02:02:57
【问题描述】:
我有一个带有以下代码的 xcode 项目:
在fflayer.h中
int *ffinjar;
在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。我不知道。谁能看到我做错了什么?
【问题讨论】:
标签: objective-c xcode integer