Adding a sprite joint
Now, the catapult at least holds itself together, but it is not the greatest structure ever created. The arm instantly falls down. What you want is the arm to stay up and then be able to be dragged backwards.
To achieve this behavior, you will use the Physics Spring Joint. The question however is what are you joining it to? Perform the following steps:
You need to hook up your arm to an invisible object that is above the catapult, which will hold the arm up. As this is a spring, which will allow the arm to be pulled in different directions and spring back.
Add a blank
CCNode
as a child of the physics node. This node will have no size. Click on Enable physics for the node and set it to be Static.Now, drag out a physics spring node and set the two bodies on the node to be between the invisible node and the catapult arm.
Build and run your game; your catapult arm should not fall down now.
You will tune the values of the spring joint later when you can test out the dragging...