-1
我有一个8x8矩阵的字母游戏,当我将触摸移动到标签中,标签值重复,如何克服这个问题,字母在8x8中随机位置矩阵。如何从CCLabelTTF精灵中获取独特的字母当触摸移动到cocos2d中
-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch=[touches anyObject];
CGPoint newlocation=[touch locationInView:[touch view]];
newlocation=[[CCDirector sharedDirector] convertToGL:newlocation];
for (int i=0; i<GRID_WIDTH; i++) {
for (int j=0; j<GRID_HEIGHT; j++) {
if (CGRectContainsPoint([grid[i][j].letter boundingBox],newlocation)) {
CCLOG(@"letters %@",[grid[i][j].letter string]);
[letterarray addObject:[grid[i][j].letter string]];
}
}
}
}
什么似乎是问题?请澄清你的问题。 – YvesLeBorg
我通过边框移动时触摸,这样得到重复的字母:乙 乙 乙 W¯¯ W¯¯ W¯¯ W¯¯ W¯¯ W¯¯ W¯¯ W¯¯ W¯¯ 我 我 –