Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

my cocos2d game currently has a ccsprite attached to a box2d body. during the game i apply different CCAnimations on my sprite, i would like to perform certain manipulations to the box2d body according to the frame currently displayed by the sprite (change rotation of the body, etc.) my current idea on implementing this is to subclass ccsprite and change the setDisplayFrame implementation but i thought somebody here probably did the same and already has a solution, so any suggestions on how to implement this?

thanks!

share|improve this question
add comment

1 Answer

I think you couple the wrong components when you do this. What you should do is implement a custom CCAnimate where you not only update the animation frame of your sprite but also the "animation frame" of your physics box. Otherwise you are coupling drawing and physics components directly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.