0
我有一个或多个存储在数组中的精灵。我想要的是用多个手指在屏幕上拖动这些精灵。即(多点触摸) 任何人都可以告诉我该怎么做?使用多点触控处理CCSprites
任何帮助将不胜感激..
这里是我的代码:
-(void)touchBegan:(CCTouch *)touch withEvent:(CCTouchEvent *)event
{
CGPoint location = [touch locationInNode:self];
selectedSprite.paused = YES;
[self selectSpriteFromTouch:location];
//this is where i get sprite selected from i.e selectedSprite from array
}
-(void)touchMoved:(CCTouch *)touch withEvent:(CCTouchEvent *)event
{
selectedSprite.position = [touch locationInNode:self];
}
-(void)touchEnded:(CCTouch *)touch withEvent:(CCTouchEvent *)event
{
selectedSprite.paused = NO;
selectedSprite.position = [touch locationInNode:self];
selectedSprite = nil;
}
-(void)touchCancelled:(CCTouch *)touch withEvent:(CCTouchEvent *)event
{
selectedSprite.paused = NO;
selectedSprite = nil;
}