2011-09-12 7 views
0

スプライトの中心にあるスプライトにタッチすると、CCSpriteで実行されているすべてのアニメーションを停止します。スプライトのアニメーションを中止したいときCocos2d

これを行うコードを思いついたり、参考になるチュートリアルへのリンクを提供してくれる人は誰でも手伝ってください。

答えて

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]; 
    } 
} 
関連する問題