我有一个代码,根据你触摸屏幕的位置设置一个弓角。 在ccTouchesMoved事件上执行简单的“bow.rotation = X”命令。 问题是,在运行0.7.1的cocos2d上的代码时,对0.9或0.8.2 它的工作方式更好,在0.9和0.8.2中,似乎它跳过了一些触摸移动事件......它可能是什么? 继承人代码......:
-(BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
if(player.state == StateNotPrepared) {
if(CGRectContainsPoint(spriteToRect(fireButton), location)) {
[player prepareShot];
[powerMeter resetBar];
[powerMeter startLoadingBar];
} else {
float newAngle = [player angleByTouchPoint: location];
[self setAngles: newAngle];
}
}
return kEventHandled;
}
-(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
if(player.state == StateNotPrepared || player.state == StatePrepared) {
if( !CGRectContainsPoint(spriteToRect(fireButton), location) ) {
float newAngle = [player angleByTouchPoint: location];
[self setAngles: newAngle];
}
}
return kEventHandled;
}
答案 0 :(得分:1)
这可能与使用的导演类型与设备的操作系统有关。尝试不同的导演,看看你是否有不同的行为。
[导演setDirectorType:XXXX];
XXXX是以下之一:
我知道有些人报告了DisplayLink导演的问题(尽管这通常是理想的,否则可用)。