我希望能够通过用户触摸来移动某些精灵图像。 东西沿着这些线路:如何让CCSprite跟随用户触摸ccTouchMoved
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches)
{
CGPoint *location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
if (CGRectContainsPoint(sprite.boundingBox, location)
{
sprite.location = ccp(location.x, location.y);
}
}
}
当然,对我来说这并不工作,因为有此方法连续移动CCSprite运行没有打勾方法。我知道的方法ccTouchMoved,但我不确定如何实现它,任何示例将不胜感激。