當這些代碼塊執行時,我的應用程序崩潰。沒有錯誤,只是警告。警告說:「在執行'ccTouchesBegan:withEvent'時出現衝突的返回類型:'void'VS'BOOL'(又名'signed char')」請幫忙。cocos2D觸摸屏崩潰
-(BOOL) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
return YES;
}
-(BOOL) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint point = [myTouch locationInView:[myTouch view]];
point = [[CCDirector sharedDirector] convertToGL:point];
CCNode *player = [self getChildByTag:kTagPlayer];
[player setPosition:point];
CCNode *computer = [self getChildByTag:kTagComputer];
[computer runAction:[CCMoveTo actionWithDuration:3.0
position:ccp(player.position.x, player.position.y)]
];
return YES;
}
我也更改爲無效,錯誤沒有消失,當我將手指放在屏幕上時,我的圖像沒有移動。你在我的編碼中看到任何可疑的東西嗎?謝謝。 – AaronChapmanDev 2012-02-17 22:59:42
永遠不要想!我有ccTouchesMoved。哇,我覺得愚蠢。它一切正常。我很抱歉浪費你時間傑克。感謝您的幫助。我想這是一種學習體驗。 ;) – AaronChapmanDev 2012-02-17 23:01:36