We also need to create a basket that can carry gifts and ornaments. Let's take a look at how to create a composite body so that we can open the top of the box and create a side and a bottom for the basket.
A composite body is a collection's
physicsBody that is clubbed together to create a new body.
basket.png for this section. This is all you will need.
Until now, we have used standard body shapes, such as circles and rectangles. To create a composite body, we can create individual shapes and attach them to the body. Let's take a look at how it is done.
Create a new function called
addBasket and add the following code into it. Also, create a global
CCSprite variable called