效果是那种鼠标触屏 、移动时 ,总有图片跟着走,这种用了什么技术啊,谢谢大家!!
------解决方案--------------------
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
//获取触摸点位置
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
//获取上一个触摸点位置
CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
//得到两个位置之间的向量
CGPoint translation = ccpSub(touchLocation, oldTouchLocation);
attackPoint = touchLocation;
//touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
if (selmagic.magiccdend)
{
selmagic.magic_ring.opacity = 250;
canmagic = YES;
//移动后的触点位置
CGPoint newPos = ccpAdd(selmagic.magic_ring.position, translation);
//让释放魔法可移动精灵随触点移动
selmagic.magic_ring.position = newPos;
}
}
按照这个方法写就可以了