当用户触摸精灵中心的精灵时,我想停止在CCSprite
上运行的所有动画。
任何人都可以帮我提供代码来执行此操作或提供可能有用的教程链接。
答案 0 :(得分:4)
你没有真正问过那个问题,我已经编辑了你的问题。我认为这应该会给你一个良好的开端。
实施CCTargetedTouchDelegateProtocol并专注于此方法。
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if (CGRectContainsPoint(GCRectMake(/*Define a rect to represent the center of your sprite*/), [touch locationInView:/*View where you want the touch to be located, usually linked to the CCDirectors OpenGL view*/])
{
[sprite stopAllActions];
}
}