【发布时间】:2011-10-15 02:17:38
【问题描述】:
当用户触摸精灵中心的精灵时,我想停止在我的CCSprite 上运行的所有动画。
谁能帮我想出代码来执行此操作或提供可能有帮助的教程链接。
【问题讨论】:
标签: ios cocos2d-iphone
当用户触摸精灵中心的精灵时,我想停止在我的CCSprite 上运行的所有动画。
谁能帮我想出代码来执行此操作或提供可能有帮助的教程链接。
【问题讨论】:
标签: ios cocos2d-iphone
你并没有真正在那里问过问题,我已经编辑了你的问题。我认为这应该给你一个好的开始。
实现 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];
}
}
【讨论】: