【发布时间】:2012-07-25 17:11:32
【问题描述】:
我一直在尝试解决一个问题很长时间,不幸的是我找不到解决方案。我希望你能帮助我...
我正在尝试开发一款回合制游戏。玩家 1 是用户,玩家 2 是 iphone。我想在轮到 player1 时收到触摸。
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
if (self.playerNo==1) { //control player1
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
[self selectSpriteForTouch:touchLocation];
return YES;
}
//if it's not player1's turn, return NO
return NO;
}
当 iPhone 转动时,我想在 5 秒内禁用触摸。我尝试了以下所有方法,但没有成功。
-(void)iphonesTurn
{
[NSThread sleepForTimeInterval:5];
//
//game logic...
//
}
在 5 秒内,我多次触摸屏幕。我意识到所有的触摸看起来都像是存储的一样,当轮到 player1 时,应用程序会对我的所有触摸做出反应。
我怎样才能完全禁用触摸?
感谢您的帮助。
【问题讨论】:
-
view.userInteractionEnabled = NO; -
不幸的是同样的事情发生了
标签: iphone cocos2d-iphone touch