我希望能够在用户触摸时移动某些精灵图像。这些方面的东西:
- (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,但我不确定如何实现它,任何示例将不胜感激。